7

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.

2 Answers 2

10

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

Sign up to request clarification or add additional context in comments.

Comments

3

Appears that

h = plt.plot(x,y)

returns a list of matplotlib.lines.Line2D objects in h even if there is one element plotted, so h[0].set_alpha() is the method to use.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.