Matplotlib - How do I set ylim() for a series of plots?

后端 未结 3 1118
温柔的废话
温柔的废话 2021-01-13 09:07

I have a series of box plots I am trying to make, each of which has a different range. I tried setting ylim by determining the max and min of each separate series. Howe

3条回答
  •  滥情空心
    2021-01-13 09:41

    You could set showfliers=False in the boxplot, so the outliers don't get plotted.

    Since you ask specifically about the whiskers, this is how they are calculated, with a default of 1.5:

    whis : float, sequence (default = 1.5) or string

    As a float, determines the reach of the whiskers past the first and third quartiles (e.g., Q3 + whis*IQR, IQR = interquartile range, Q3-Q1). Beyond the whiskers, data are considered outliers and are plotted as individual points. Set this to an unreasonably high value to force the whiskers to show the min and max values. Alternatively, set this to an ascending sequence of percentile (e.g., [5, 95]) to set the whiskers at specific percentiles of the data. Finally, whis can be the string ‘range’ to force the whiskers to the min and max of the data. In the edge case that the 25th and 75th percentiles are equivalent, whis will be automatically set to ‘range’.

    You could do the same calculation and set your ylim to that.

提交回复
热议问题