Skip to content

Instantly share code, notes, and snippets.

@MatthewJA
Created September 7, 2017 04:27
Show Gist options
  • Save MatthewJA/5a0a6d75748bf5cb5962cb9d5572a6ce to your computer and use it in GitHub Desktop.
Save MatthewJA/5a0a6d75748bf5cb5962cb9d5572a6ce to your computer and use it in GitHub Desktop.
Simple cyclic matplotlib colourmap based on viridis.
import matplotlib.cm
import matplotlib.colors
cyclic_viridis = matplotlib.colors.LinearSegmentedColormap.from_list(
'cyclic_viridis',
[(0, matplotlib.cm.viridis.colors[0]),
(0.25, matplotlib.cm.viridis.colors[256 // 3]),
(0.5, matplotlib.cm.viridis.colors[2 * 256 // 3]),
(0.75, matplotlib.cm.viridis.colors[-1]),
(1.0, matplotlib.cm.viridis.colors[0])])
@makingwaves27
Copy link

image
Thanks! Just what I needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment