![]() ![]() Looking through matplotlib's source code we find that matplotlib uses _stats to compute the statistics used in the boxplot. stats and the whisker locations stats and stats. You could counter this by recomputing eg. However, viewing the plot produced we see that altering q1 and q3 whilst leaving the whiskers unchanged may not be a sensible idea. # Plot boxplots from our computed statisticsĪx.bxp(, stats, stats], positions=range(3)) ![]() # For box C compute the 25th and 75th percentiles (matplotlib default) # For box B compute the 10th and 90th percentiles # For box A compute the 1st and 99th percentiles Stats = cbook.boxplot_stats(data, labels='C') Stats = cbook.boxplot_stats(data, labels='B') Stats = cbook.boxplot_stats(data, labels='A') # Compute the boxplot stats (as in the default matplotlib implementation) Quick solutionĪ quick fix (ignoring any implications for whisker locations) is to compute the boxplot statistics we desire, alter the locations of q1 and q3, and then plot with ax.bxp: import matplotlib.cbook as cbook You should also carefully consider what altering the box percentiles means to outlier classification and the whiskers of the boxplot. Thus, you should be aware that departing from this convention puts you at risk of misleading readers. With box and whisker plots it is convention to plot the 25th and 75th percentiles of the data. ![]() Yes, it is possible to plot a boxplot with box edges at any percentiles you desire. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |