How to add a mean and median line to a Seaborn displot

Using FacetGrid directly is not recommended. Instead, use other figure-level methods like seaborn.displot seaborn.FacetGrid.map works with figure-level methods. seaborn: Building structured multi-plot grids Tested in python 3.8.11, pandas 1.3.2, matplotlib 3.4.3, seaborn 0.11.2 Option 1 Use plt. instead of ax. In the OP, the vlines are going to ax for the histplot, but here, the … Read more

Pandas bar plot with binned range

You can make use of pd.cut to partition the values into bins corresponding to each interval and then take each interval’s total counts using pd.value_counts. Plot a bar graph later, additionally replace the X-axis tick labels with the category name to which that particular tick belongs. out = pd.cut(s, bins=[0, 0.35, 0.7, 1], include_lowest=True) ax … Read more