0

I am trying to indicate a "dangerous" zone in my sns boxplot.

So far this is what i came up with:

plt.fill_between([0, 6], [danger, danger], danger * 1.2, color='salmon', alpha=0.5)

But since I use sns boxplot, the x values are totally messed up and i had to play with it to get the following result:

enter image description here

I cant really increase the polygon size as the plot grows with it (understandingly). Ideally i would have wanted to simply paint everything above this threshold as red like so: enter image description here

Dr. Prof. Patrick
  • 1,280
  • 2
  • 15
  • 27
  • Usually, people save the x and y limits in variables, then add the `fill_between`, and then set the original limits again. The upper y limit and the x limits can be used in the `fill_between` – JohanC Dec 13 '22 at 14:25
  • 1
    You want [`axvspan`](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.axvspan.html) here – mwaskom Dec 15 '22 at 12:31

0 Answers0