Home > Back-end >  How to dock bars to the bottom of the bounding box with Matplotlib in Python?
How to dock bars to the bottom of the bounding box with Matplotlib in Python?

Time:01-21

I'm drawing a Barplot in Python with matplotlib, and currently it looks as follows.

enter image description here

Briefly, I'm measuring a quantity called EOD under different settings (represented with different colors), and plotting the mean and std. dev. values for each setting over multiple measurements I've done.

The problem is, this EOD quantity can strictly take non-negative values so the area under 0 is misleading. I know this happens because for some settings (for example the blue one) the std. dev is larger than mean value. Still, I'd like to prevent this.

In short, how can I dock my bars to the bottom of the bounding box where it should start from 0?

CodePudding user response:

ax.set_ylim(ymin=0)

did the trick as suggested by JohanC in the comments.

  •  Tags:  
  • Related