假设我有以下内容:
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)
如何填写伪代码行:
# lines of pseudo code
cmap = plt.(...).get_cmap('magma', low=0, high=len(data_mats))
color = cmap(i)
使用pyplot吗?
(为什么在matplotlib网站上所有密集的示例,而不是一些代码规范?)
答案 0 :(得分:0)
import matplotlib.pyplot as plt
i = 10
file_ct = 100
cmap = plt.cm.magma
color = cmap(float(i+1) / float(file_ct))