OK, I think this is probably simple but I've searched extensively and can't find anything. What I want to do is specify the precise RGB colour values of a contour line generated with matplotlib. I know that if I do something like :
plt.contour(X,Y,Z,[0.1,0.2,0.3],colors='k')
then I'll get three contour levels which are all black, or if I were to substitute 'w' in place of 'k' then the contours would all be white. That's fine, but what I need to do is something like this :
plt.contour(X,Y,Z,[0.1,0.2,0.3],colors=(1.0,0.25,0.75)
Where the colours not chosen from some in-built presets but have RGB (or RGBA) values precisely defined by me.
Any ideas ?
You should give a list with colors. If the list is 1 color long, it will use that color for all contours.
plt.contour(X, Y, Z, [0.1,0.2,0.3], colors = [(1.0,0.25,0.75)])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With