first time asking question on stackoverflow. Am trying to put in text into my boxplot, however after i had arranged my x-axis in a specific order [superior,deluxe,family]. The data labels are not longer following that order. How should i change my codes to reflect in that specific order? Output image attached. Thanks
RoomCategory ADR
514 Superior 114.75
515 Family 372.88
516 Deluxe 182.5
517 Deluxe 300.0
518 Family 371.45
519 Family 320.0
520 Deluxe 300.0
521 Family 414.0
box_plot = sns.boxplot(data=bgr21, x='RoomCategory',y='ADR',order=['Superior','Deluxe','Family'])
# printing the median value in the boxplot
medians= bgr21.groupby(['RoomCategory'])['ADR'].median()
vertical_offset = bgr21['ADR'].median() * 0.05 # offset from median for display
round_medians = np.round(medians,2)
for xtick in box_plot.get_xticks():
box_plot.text(xtick,round_medians[xtick] vertical_offset,round_medians[xtick],
horizontalalignment='center', size='large',color='b',weight='semibold')