How do I get rid of the grey background in the plot below made using foll command in python matplotlib
ax.bar(x_axis,bar_val,yerr=err_val,linewidth=0,width=0.2)
If you want to make something completely transparent, simply set the alpha value of the corresponding color to 0. For plt. savefig , there is also a "lazy" option by setting the rc-parameter savefig. transparent to True , which sets the alpha of all facecolors to 0%.
We can set the Inner and Outer colors of the plot. set_facecolor() method is used to change the inner background color of the plot. figure(facecolor='color') method is used to change the outer background color of the plot.
Matplotlib allows you to regulate the transparency of a graph plot using the alpha attribute. By default, alpha=1. If you would like to form the graph plot more transparent, then you'll make alpha but 1, such as 0.5 or 0.25.
The set_axis_bgcolor
function was deprecated in version 2.0. Use set_facecolor
instead. Your code would be:
ax.set_facecolor('white')
Firstly, I should point out that the grey background is not the default for matplotlib. Are you using something like seaborn, which (inappropriately, in my opinion) messes with matplotlib's defaults by default whenever you import it?
As I'm assuming ax is already your axis, you can just do:
ax.set_axis_bgcolor('white')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With