Reputation: 31216
Suppose I have the following:
data_mats = [ ... ]
# pseudo code
cmap = plt.(...).get_cmap('magma', low=0, high=len(data_mats))
for i in range(0,len(data_mats)):
# pseudo code
color = cmap(i)
mat = data_mats[i]
plt.plot(mat[:,1],mat[:,2], color=color)
How do I fill in the lines of pseudo code:
# lines of pseudo code
cmap = plt.(...).get_cmap('magma', low=0, high=len(data_mats))
color = cmap(i)
Using pyplot?
(why all the dense examples on matplotlib's website, rather than some code specs?)
Upvotes: 2
Views: 1228
Reputation: 31216
import matplotlib.pyplot as plt
i = 10
file_ct = 100
cmap = plt.cm.magma
color = cmap(float(i+1) / float(file_ct))
Upvotes: 1