(category, cmap_list)
| 105 | |
| 106 | |
| 107 | def 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 | # %% |
no test coverage detected
searching dependent graphs…