import numpy as np
import matplotlib.pyplot as plt
import WrightTools as wt

num = len(wt.artists.colormaps)
fig, axes = plt.subplots(nrows=num*3, figsize=(6, num/2.5))
fig.subplots_adjust(top=0.95, bottom=0.01, left=0.2, right=0.99)
gradient = np.linspace(0, 1, 256)
gradient = np.vstack((gradient, gradient))
axis_index = 0

for name, cmap in wt.artists.colormaps.items():
    # color
    ax = axes[axis_index]
    ax.imshow(gradient, aspect='auto', cmap=wt.artists.grayify_cmap(cmap))
    axis_index += 1
    # color
    ax = axes[axis_index]
    ax.imshow(gradient, aspect='auto', cmap=cmap)
    pos = list(ax.get_position().bounds)
    x_text = pos[0] - 0.01
    y_text = pos[1] + pos[3]
    fig.text(x_text, y_text, name, va='center', ha='right', fontsize=10)
    axis_index += 2

for ax in axes:
        ax.set_axis_off()