Skip to content

Boxfill legend incorrect when there are fewer colors than levels #1894

@chaosphere2112

Description

@chaosphere2112

When you plot a boxfill and use the color_1 and color_2 attributes (but leave level_1 and level_2 alone), the legend doubles up for the last level color. Also, the labeling on the legend is excessive (we probably don't need 10+ labels when there are only 4 levels).

import vcs, cdms2
f = cdms2.open(vcs.sample_data + "/clt.nc")
s = f("clt")
x = vcs.init()
box = vcs.createboxfill()
# Set them to the obnoxious end of the colormap so we can see the steps between each color
box.color_1 = 242
box.color_2 = 246
x.plot(s, box)

results in:

out

I've got a PR incoming to fix this.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions