Issue
I have a scatterplot:
x=[0.1,0.2,0.3,0.4]
y=[0.1,0.3,0.4,0.6]
I would like to plot it adding transparency in each point, so I used
plt.scatter(x,y,alpha =0.5, marker='o',color='g', markersize=12)
However, what happens is that I get circles filled with green colours and with a transpacency all over. What I would like to get is transparency only in the inner region, and edges really visible, so that if I have may points close to each other, I can always see the borders. Is there a way?
Solution
You can specify the edge- and facecolor independently. For the facecolor you can choose a color with an alpha of less then 1. To specify such color use an RGBA (red,green,blue,alpha) tuple.
import matplotlib.pyplot as plt
x=[0.1, 0.105, 0.2, 0.3, 0.4]
y=[0.1, 0.095, 0.3, 0.4, 0.6]
plt.scatter(x,y, s=144, marker='o', edgecolor='g', facecolor=(0,1,0,0.5), )
plt.show()
Answered By - ImportanceOfBeingErnest
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.