0
从我的所有其他恼人难以理解的帖子 继我有一个列表:彩条matplotlib颜色以蓝色
[0,1,4,3,2,4,2,1,0]
我希望他们每个人都使用
cmap = mpl.colors.ListedColormap([[1,0,0],[0,0,1],[0,1,0],[1,1,0],[0,1,1]])
颜色
将使我的颜色为红色,蓝色绿色黄色和淡蓝色。
我想要的是颜色从红色开始,以蓝色结束,其他颜色在这些颜色之间。
我可能能够以同样的方式做到这一点,但我猜测会有更好的方法,然后使用某种方程?
做这些帮助呢? http://matplotlib.org/examples/pylab_examples/show_colormaps.html – mgilson 2013-02-20 13:24:59
您需要使用LinearSegmentedColormap而不是ListedColorMap。 – 2013-02-20 14:27:57
您可以在此处看到使用LinearSegmentedColormap的示例:http://stackoverflow.com/questions/9893440/python-matplotlib-colormap或http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps。文档:http://matplotlib.org/api/colors_api.html#matplotlib.colors.LinearSegmentedColormap – joris 2013-02-20 18:54:57