简体   繁体   中英

How to get the python color value for a RGB tuple

I need to plot graphs in a specific color. Is there a way to convert a RGB tuple, for example (188,32,75) in such a way that I can use it as a python color?

I tried

plt.plot(X,Y,marker='d',color=(188,32,75))

but I get an error, that RGB/A values should be in [0,1].

只需将您的颜色代码除以255,即可使其达到所需的[0,1]范围

plt.plot(X,Y,marker='d',color=(188/255.0, 32/255.0, 75/255.0))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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