Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to set the marker edge alpha in Matplotlib?

For example, say I want to plot with color='None' but markeredgecolor='mediumseagreen' with the edges having alpha=0.5. Is that possible?

like image 664
8one6 Avatar asked Sep 11 '14 15:09

8one6


People also ask

How do I make markers transparent in matplotlib?

MatPlotLib with Python Create x_data and y_data(sin(x_data)), using numpy. Plot curve using x_data and y_data, with marker style and marker size. By changing the alpha, we can make it transparent to opaque.

How do I change the alpha in matplotlib?

You can update the alpha value of an existing Line2D , using the set_alpha method. The idea would be to plot the line once and then update the alpha in the loop.

How do I change the transparency of a line in matplotlib?

Matplotlib allows you to adjust the transparency of a graph plot using the alpha attribute. If you want to make the graph plot more transparent, then you can make alpha less than 1, such as 0.5 or 0.25. If you want to make the graph plot less transparent, then you can make alpha greater than 1.


1 Answers

As answered in the comments:

Either pass the color as an RGBA tuple or get the RGBA value from colorConverter:

matplotlib.colors.colorConverter.to_rgba('mediumseagreen', alpha=.5)
like image 167
Shovalt Avatar answered Sep 30 '22 10:09

Shovalt