如何在matplotlib中获取默认的colormap

时间:2017-12-12 12:47:43

标签: python matplotlib

有没有办法在matplotlib中获取默认的色彩映射?

我喜欢它,并且我有许多情节对,我想以“平行”颜色绘制,例如用实线绘制一条曲线,用点缀的相同颜色绘制另一条曲线。

import matplotlib.pyplot as plt

fig = plt.figure(...)
ax = plt.add_subplot(1,1,1)
# obtain data from somewhere
t = ...
data_primary = ...    # list of y-axis data arrays
data_secondary = ...  # list of y-axis data arrays
# 
colormap = ?????????  # get colormap from somewhere
k = 0
for y_a, y_b in zip(data_primary, data_secondary):
    ax.plot(t,y_a,color = colormap[k], linestyle = '-')
    ax.plot(t,y_b,color = colormap[k], linestyle = ':')
    k += 1

0 个答案:

没有答案