For some reason my median box plot numbers are not on top of the correct boxplot. Here is my code:
# bar plot for all filenames based on their mean pixel value
sns.set(style = "ticks", palette = "pastel")
box_plot = sns.boxplot(y="mean_pixel_value", x="filename",
palette=["m","g"],
data=df_ts)
sns.despine(offset=10, trim=True)
plt.setp(box_plot.get_xticklabels(),rotation=70)
medians = df_ts.groupby(['filename'])['mean_pixel_value'].median()
vertical_offset=df_ts['mean_pixel_value'].median()*0.3
for xtick in box_plot.get_xticks():
box_plot.text(xtick,medians[xtick] + vertical_offset,medians[xtick],
horizontalalignment='center',size='small',color='blue',weight='semibold', rotation = 90)
As you can see in the screenshot below, the median numbers aren't matching up to their respective box plot, especially in the last 3 filenames. 5049 should be on top of SM05334, 4908 on top of SM05330 and 4826 on top off SM05326. Any ideas on why this is happening?

