简体   繁体   English

python中的对比调色板

[英]Contrasting color palette in python

Can someone tell me how I can generate a contrasting color palette in python. 有人可以告诉我如何在python中生成对比色的调色板。 I need a set of colors that give a good contrast (distinguished easily) on a plot in color and B/W. 我需要一套可以在彩色和黑白图上提供良好对比度(容易区分)的颜色。 It is important to have contrast in B/W if not completely in color. 如果彩色不完全,则黑白对比度很重要。

Thanks 谢谢

edit: I am currently using matplotlib, python 2.7. 编辑:我目前正在使用matplotlib,python 2.7。 I use the default pyplot which generates colors which can sometimes be very close specially when converted to B/W. 我使用默认的pyplot来生成颜色,有时在转换为黑白时有时会非常接近。 I would like to generate colors that can be distinguished easily even in shades of grey. 我想生成即使在灰色阴影下也可以轻松区分的颜色。 I am not using any additional libraries. 我没有使用任何其他库。

In plotting what you describe as a color palette is referred to as colormap . 在绘制您描述为调色板的内容时称为colormap

There are several sequential colormaps that fulfill the desired properties. 有几个顺序的色图可满足所需的属性。 I suggest you have a look at the colormaps provided by matplotlib ( examples ) for starters, but I agree it is hard to find ones with perceptually linear luminance that really add something to just B/W. 我建议您看一下matplotlib( 示例 )为初学者提供的色图,但是我同意很难找到具有感知线性亮度的色图,这些色图确实会给黑白增添色彩。

If you like to devulge further into the topic of finding the 'perfect' colormap, I suggest you have a look at the works by Kenneth Moreland and Peter Kovesi . 如果您想进一步探讨寻找“完美”色彩图的主题,建议您看看Kenneth MorelandPeter Kovesi的作品。 They both provide links for using/generating their colormaps in python. 它们都提供了在python中使用/生成其颜色图的链接。

I find the colormaps by Kenneth Moreland to be especially intriguing for perceptually linear luminance or linearly increasing brightness. 我发现肯尼思·莫兰德(Kenneth Moreland)的色彩图对于感知线性亮度或线性增加亮度特别有趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM