Skip to content

Instantly share code, notes, and snippets.

@Raudcu
Created July 1, 2019 13:56
Show Gist options
  • Save Raudcu/9e72c73208c41e7c3de3cdfb671eb3e1 to your computer and use it in GitHub Desktop.
Save Raudcu/9e72c73208c41e7c3de3cdfb671eb3e1 to your computer and use it in GitHub Desktop.
Plotting lines using a matplotlib colormap
import matplotlib.pyplot as plt
import matplotlib.cm as cmap
import matplotlib.colors as mcolors
rain = cmap.ScalarMappable(norm=mcolors.Normalize(vmin=0,vmax=1.), cmap='rainbow')
for i in range(10):
plt.plot(range(10), [x*i for x in range(10)], c=rain.to_rgba(i/10))
plt.show()
@Raudcu
Copy link
Author

Raudcu commented Jul 1, 2019

colormap

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