MCPcopy
hub / github.com/matplotlib/matplotlib / plot_color_gradients

Function plot_color_gradients

galleries/users_explain/colors/colormaps.py:107–126  ·  view source on GitHub ↗
(category, cmap_list)

Source from the content-addressed store, hash-verified

105
106
107def plot_color_gradients(category, cmap_list):
108 # Create figure and adjust figure height to number of colormaps
109 nrows = len(cmap_list)
110 figh = 0.35 + 0.15 + (nrows + (nrows - 1) * 0.1) * 0.22
111 fig, axs = plt.subplots(nrows=nrows + 1, figsize=(6.4, figh))
112 fig.subplots_adjust(top=1 - 0.35 / figh, bottom=0.15 / figh,
113 left=0.2, right=0.99)
114 axs[0].set_title(f'{category} colormaps', fontsize=14)
115
116 for ax, name in zip(axs, cmap_list):
117 ax.imshow(gradient, aspect='auto', cmap=mpl.colormaps[name])
118 ax.text(-0.01, 0.5, name, va='center', ha='right', fontsize=10,
119 transform=ax.transAxes)
120
121 # Turn off *all* ticks & spines, not just the ones with colormaps.
122 for ax in axs:
123 ax.set_axis_off()
124
125 # Save colormap list for later.
126 cmaps[category] = cmap_list
127
128
129# %%

Callers 1

colormaps.pyFile · 0.70

Calls 9

subplots_adjustMethod · 0.80
imshowMethod · 0.80
suptitleMethod · 0.80
subplotsMethod · 0.45
set_titleMethod · 0.45
textMethod · 0.45
set_axis_offMethod · 0.45
get_positionMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…