You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While I was updating truncate_colormap in viz, I noticed the parameter n wasn't working as intended. It would need to be specified as a parameter in mpl.colors.LinearSegmentedColormap.from_list rather than in np.linspace in order to specify the number of color values in the new colormap.
I thought maybe this was related to a change in matplotlib, but that doesn't appear to be the case.
Interestingly there are workaround(s) for this in the examples gallery. For example, in NCL_vector_4.py the colormap is truncated with n=16, but this doesn't work so then get_cmap is used to re-register it and give it 16 levels as desired or when using contourf the number of levels is assigned so it doesn't matter that truncate_colormap doesn't work as intended.
We should probably also clean up the colormap registration and deprecated colormap functions in examples. I'll log an issue over there.
The text was updated successfully, but these errors were encountered:
Update truncate_colormap to use new matplotlib colormap registration to partially address issues NCAR#112 and NCAR#104.
Update truncate_colormap to actually return a colormap with n color segments to address issue NCAR#124.
While I was updating
truncate_colormap
in viz, I noticed the parametern
wasn't working as intended. It would need to be specified as a parameter inmpl.colors.LinearSegmentedColormap.from_list
rather than innp.linspace
in order to specify the number of color values in the new colormap.I thought maybe this was related to a change in matplotlib, but that doesn't appear to be the case.
Interestingly there are workaround(s) for this in the examples gallery. For example, in NCL_vector_4.py the colormap is truncated with n=16, but this doesn't work so then
get_cmap
is used to re-register it and give it 16 levels as desired or when usingcontourf
the number of levels is assigned so it doesn't matter thattruncate_colormap
doesn't work as intended.We should probably also clean up the colormap registration and deprecated colormap functions in examples. I'll log an issue over there.
The text was updated successfully, but these errors were encountered: