I was able to visualize my data in a boxplot using Seaborn.
sns.boxplot( x=df['Score'].astype('float'), y=df['Group'] )
The visualization shows me: all four quartiles, lower and upper whisker, and some outliers. How can I also add the Mean line into the boxplots? See current visualization (without mean).
Thanks!
Make a box and whisker plot using boxplot() method with different facecolors. To place the legend, use legend() method with two boxplots, bp1 and bp2, and ordered label for legend elements. To display the figure, use show() method.
The box covers the interquartile interval, where 50% of the data is found. The vertical line that split the box in two is the median. Sometimes, the mean is also indicated by a dot or a cross on the box plot.
MatPlotLib with Python To show mean in a box plot, we can use showmeans=True in the argument of boxplot() method.
Creating Box PlotThe matplotlib. pyplot module of matplotlib library provides boxplot() function with the help of which we can create box plots. The data values given to the ax. boxplot() method can be a Numpy array or Python list or Tuple of arrays.
I just figured it out. The code works like this:
sns.boxplot(x=df['Score'].astype('float'), y=df['Group'],showmeans=True )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With