Error bars in barplot do not respect clip_on
See original GitHub issueHello! It seems that error bars do not have clearly defined clipping behavior within barplots.
Expected behavior: Setting clip_on=True should result in neither bars or error bars being clipped.
Actual behavior: When setting clip_on to be True, bars in the bar plots are (correctly) not clipped at plot borders. However, errorbars are clipped.
Platform: Seaborn: 0.9.0 (though also appears to be the case in 0.10.1), Linux (*buntu), Python: 3.6.8, Matplotlib: 3.0.2
Here is a MWE:
import pandas
import seaborn as sns
import matplotlib.pyplot as plt
mdf = pandas.DataFrame({"a": [5, 8, 9, 10, 1, 2, 3, 4], "b": [0, 0, 0, 0, 1, 1, 1, 1]})
sns.barplot(data=mdf, x="b", y="a", clip_on=False)
plt.gca().set_ylim(0, 7.5)
plt.tight_layout(rect=[0, 0, 1, .5])
plt.show()
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Barplot with error bars - The R Graph Gallery
Error bars give a general idea of how precise a measurement is, or conversely, how far from the reported value the true (error...
Read more >The issue with error bars - From data to Viz
Error bars give a general idea of how precise a measurement is, or conversely, how far from the reported value the true (error...
Read more >Turn off error bars in Seaborn Bar Plot - Stack Overflow
I'm using GridSpec in matplotlib to create a page that has 9 subplots. One of the subplots is a ...
Read more >Adding error bars to a grouped bar plot - MATLAB Answers
Hi! I'm trying to plot a grouped bar graph with standard errors, and have managed this so far, which almost works but the...
Read more >Adding error bars to a simple bar plot
The easy solution to finding the bar centers is in the barplot() command itself: in addition to plotting the graph, the function also...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It’s reasonable to have this expectation, but it’s not correct. The kwargs (as the docs say) are passed through to
ax.bar
only. But you could do e.g.Yes, it is true that other kwargs are passed through to
ax.bar
. If the bar itself extended past the axis limits, it would be visible. But the error bars are drawn usingax.plot
.