Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

set alpha channel for pyplot objects?

Tags:

matplotlib

In R, you can set the alpha channel by

rgb(r=.1,g=.5,b=.5,alpha=.5,max=1)

for any object that takes a color argument. patch objects in pyplot have a set_alpha method, but can this be done for lines on a plot, for instance? like pyplot.plot(x,y,color=???) or h = pyplot.plot(x,y) and do something with h.

like image 733
hatmatrix Avatar asked Dec 10 '11 15:12

hatmatrix


1 Answers

plt.plot(x,y,'ro-',alpha=0.3)

if you want to mix up your own color, you can pass a hex value or an rgb tuple http://matplotlib.sourceforge.net/api/colors_api.html

like image 67
ev-br Avatar answered Nov 18 '22 00:11

ev-br