Matplotlib PyPlot – Bar Plot without Filling the Bar Faces
To draw a Bar Plot without filling the bar faces in Matplotlib, call matplotlib.pyplot.bar()
function, and pass False
for fill
parameter.
The following is the code snippet to call bar()
function with fill
parameter set to False. Of course there would be other parameters like x
, height
, etc., but for understanding fill
parameter, only fill
parameter has been specified.
bar(fill=False)
Example
In the following program, we will draw a bar plot, with the bar faces not filled with color. Only the outline is displayed.
example.py
import matplotlib.pyplot as plt #data x = [1, 2, 3, 4, 5] h = [10, 8, 12, 4, 7] #bar plot plt.bar(x, height = h, fill = False) plt.show()
Output
ADVERTISEMENT
Conclusion
In this Matplotlib Tutorial, we learned how to draw bar plot without filling the bar faces with color, using Matplotlib PyPlot API.