Closed gamaanderson closed 8 years ago
My first instinct would be to add a 'norm' keyword to the Vcmap. Have it default to None which uses linear Normalize() function and then add the norm=cmap['norm'] argument to the plotting routines.
To allow adjustments, I guess we could add a dialog box something like the limits on the drop-down Display Options toolbar.
and how does that new key and the current vmin and vmax work together?
Of course, adding a norm argument make little sense with out a plugin to edit the colormap, but we have being needing some improvement in this any way.
Having a value of None should not have any effect since the vmin/vmax are already passed to the plot routines. It could be instituted in the artview.components.plot_radar._set_default_cmap
and plot_grid version.
We could institute an additional step of calculating the norm, but take look here. This is a little bit different implementation, but the idea is the same. I feel this is something that could be done behind the scenes in Py-ART, by using the cmap and a keyword of boundaries. What do you think @jjhelmus ?
I agree that this would be a nice feature for ARTview.
How to deal with the norm
parameter in ARTView is tricky.
My idea of adding the parameter was to allow users to create a categorical or non-linearly scaled colormap by passing a Matplotlib BoundaryNorm or LogNorm instance. This unlocks some interesting plotting possibilities but also means that the user needs to do some work to create the object to pass in as the norm
argument.
ARTView could allow a users to switch to a log scaling colorbar without the addition of too much code, the LogNorm instance would need to be created inside ARTView. As @gamaanderson mentioned the categorical option will require more work as first some method allowing the user to specify the bounds would need to be created.
and how does that new key and the current vmin and vmax work together?
If norm is specified as anything other than None
then vmin and vmax are ignored by setting them to None
. This is handled by the parse_norm_vmin_vmax function which is called in all of the public plot_
methods.
We could institute an additional step of calculating the norm, but take look here. This is a little bit different implementation, but the idea is the same. I feel this is something that could be done behind the scenes in Py-ART, by using the cmap and a keyword of boundaries. What do you think @jjhelmus ?
I like this idea but I'd rather it not be implemented as an additional argument to the plot_
methods. Those methods are getting quite clutters as it is. I think a more maintainable solution would be to have some helper function which generates the cmap
and norm
parameters from a set of discrete levels, basically what the from_levels_and_colors
code is doing in the linked code. Then instruct users to use these helpers to generate the parameters and then pass them to the plot_
methods. The other option I see to clean up these methods is to use kwargs to catch everything and then parse that dictionary.
FYI: I have started working on this.
I'm sorry for the delay. I'll look at it this week. I wanted to keep my ARTview at stable place for the presentation (today)!
PyART recently introduced a new argument for non-linear colormap (see here). I'm not really sure how to add this to artview, I would like some ideas (@nguy,@jjhelmus).
Any way, this is just for artview 1.3. We need to finish 1.2 still.