1>>> import seaborn as sns
2>>> sns.set_theme(style="whitegrid")
3>>> ax = sns.boxplot(x=tips["total_bill"])
4
1# Show the median value in a boxplot for seaborn sns
2
3box_plot = sns.boxplot(x = df['ur_data'], y = df['ur_data2'])
4
5medians = df.groupby(['ur_data'])['ur_data2'].median()
6vertical_offset = df['ur_data2'].median() * 0.05
7
8for xtick in box_plot.get_xticks():
9 box_plot.text(xtick,medians[xtick] + vertical_offset,medians[xtick],
10 horizontalalignment='center',size='x-small',color='w',weight='semibold')