INNER CODE UNIT · Python
colors
ljvmiranda921/sprites-as-a-service · backend/sprites/sprites.py:83
colors = base_colors + random_colors
logger.trace(f"Colors to use: {colors}")
cm.register_cmap(
cmap=mpl.colors.LinearSegmentedColormap.from_list(
"custom", colors
).reversed()
)
logger.debug("Preparing final image")
fig, axs = plt.subplots(1, 1, figsize=(1, 1), dpi=size)
axs = fig.add_axes([0, 0, 1, 1], xticks=[], yticks=[], frameon=False)
axs.imshow(sprite_final, cmap="custom_r", interpolation="nearest")
logger.debug("Successfully generated sprite!")
return fig
def _custom_rule(
X: np.ndarray, n_extinct: int = 3, n_survive: int = 3