Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set matplotlib plot to "no fill"?

I'd like to superimpose one plot over another (they are polygons, really in some lat/lon space, using geopandas, but the plot is simply derived from matplotlib)

I have:

figZ, axZ = plt.subplots(1, figsize=(11,8.5))
Sfig = X.plot(ax=axZ, color='white', edgecolor='black', lw=0.7)
Y.plot(ax=axZ, color='white', edgecolor='black', lw=0.7, alpha=0.3)

How do I set Sfig's color to "no-fill" instead of white? The way it is now it "blurs" my Sfig image (X.plot) by the alpha of the Y.plot one. How do I set "color" to actually transparent?

like image 844
Dervin Thunk Avatar asked Dec 16 '17 15:12

Dervin Thunk


People also ask

How do I save a matplotlib plot without white space?

Hide the Whitespaces and Borders in Matplotlib Figure To get rid of whitespace around the border, we can set bbox_inches='tight' in the savefig() method. Similarly, to remove the white border around the image while we set pad_inches = 0 in the savefig() method.

What happens if I dont use %Matplotlib inline?

In the current versions of the IPython notebook and jupyter notebook, it is not necessary to use the %matplotlib inline function. As, whether you call matplotlib. pyplot. show() function or not, the graph output will be displayed in any case.


1 Answers

I don't expect upvotes, but this is what I found as solution. I'll vote up better ones if they exist:

Sfig = X.plot(ax=axZ, facecolor="none", 
              edgecolor='black', lw=0.7)
like image 177
Dervin Thunk Avatar answered Oct 27 '22 19:10

Dervin Thunk