CDAT / vcs

Visualization Control System
19 stars 13 forks source link

VCS Legend issues #22

Open chaosphere2112 opened 7 years ago

chaosphere2112 commented 7 years ago

Looks like there are a couple of issues with the legend (at least when using boxfill).

This notebook illustrates most of the issues I found, but I'll break it down individually as well.

boxfill.legend label placement is wrong

When you assign values to it, it should use that dictionary to draw tickmarks on the legend at the appropriate point for the values used as the keys; this should work fine:

import vcs
box_data = [range(0, 100, 20) for _ in range(5)]
boxfill = vcs.createboxfill()
boxfill.boxfill_type = "custom"
boxfill.levels = [0, 10, 30]
boxfill.legend = {1: "one", 16: "sixteen", 25: "twentyfive"}
x = vcs.init()
x.plot(box_data, boxfill)

legend_placement

Legend will draw as many sections as it can

When you have more fillarea* items than levels, weird stuff starts to happen with the legend (though the data looks fine).

import vcs, cdms2
x = vcs.init()
f = cdms2.open(vcs.sample_data + '/clt.nc')
s = f('clt')
box = vcs.createboxfill()
box.boxfill_type = "custom"
box.fillareacolors = [1, 2, 3, 4]
box.fillareaindices = [2, 3, 4, 5]
box.fillareastyle = "hatch"
box.levels = [0, 50, 100]
x.plot(s, box)

wat

At some point I was also able to make legend sections draw over themselves, but I haven't been able to reproduce that one yet.

aashish24 commented 7 years ago

@chaosphere2112 okay if @danlipsa look into this?

chaosphere2112 commented 7 years ago

@aashish24 Yup, that's fine with me. I don't really work on VCS proper anymore, besides miscellaneous bug fixes I need in a hurry.

doutriaux1 commented 5 years ago

First one is fixed second one is still true, even weirder when plotting the data is first REALLY weird but x.png fixes it

scottwittenburg commented 5 years ago

This can be fixed where we draw the legend.