Skip to content

Commit

Permalink
MNT improve formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdoc committed Apr 3, 2024
1 parent 147c119 commit 32e60e1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cortex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,13 +1032,14 @@ def add_cmap(cmap, name, cmapdir=None):
or `cortex.webgl.show()`.
"""
import matplotlib.pyplot as plt

x = np.linspace(0, 1, 256)
cmap_im = cmap(x).reshape((1,256,4))
cmap_im = cmap(x).reshape((1, 256, 4))
if cmapdir is None:
# Probably won't work due to permissions...
cmapdir = config.get('webgl', 'colormaps')
cmapdir = config.get("webgl", "colormaps")
# Make sure name ends with png
name = name if name.endswith('.png') else f"{name}.png"
name = name if name.endswith(".png") else f"{name}.png"
plt.imsave(os.path.join(cmapdir, name), cmap_im, format="png")


Expand Down

0 comments on commit 32e60e1

Please sign in to comment.