matplot再也不缺颜色啦

你。 提交于 2020-02-13 17:10:55
# -*- coding: UTF-8 -*-
__author__ = 'zy'
__time__ = '2019/8/31 16:55'
import matplotlib.pyplot as plt

from matplotlib import cm
from numpy import linspace

start = 0.0
stop = 1.0
number_of_lines= 7
cm_subsection = linspace(start, stop, number_of_lines)

print(cm_subsection)

colors = [ cm.jet(x) for x in cm_subsection ]

print(colors)
for i, color in enumerate(colors):
    plt.axhline(i, color=color)

plt.ylabel('Line Number')
plt.show()

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!