user308827 user308827 - 1 year ago 92
Python Question

Getting length of colormap in matplotlib

Is there a way to get length of matplotlib colormap?

cmap = mpl.colors.ListedColormap(['r', 'g', 'b', 'c'])

something like cmap.len()?

Answer Source

The list of colors is in member colors:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download