Search code examples
pandasseabornaxisnames

Change the axis name seaborn plot from value/variable


enter image description hereI am working on a dataframe that consists of multiple of columns that corresponds to different part of the drive (e.g. right turn, left turn, etc.) and rows that correspond to driver's id. Overall, I want to plot the values of all the different columns. My code is here and is successful except of one aspect: the displayed names on the x,y axes are not the ones I want.

ax = sns.boxplot(x="variable", y="value", data=pd.melt(mvel))
sns.set_palette("muted")
plt.setp(ax.get_xticklabels(), rotation=70)
plt.savefig('mvel_6turntypes.png', dpi=400, bbox_inches='tight')

So x, y axes names are value and variable. I want to change these names to correspond to my data.


Solution

  • To change the labels you can do by:

    Setting direct to the plot

    plt.xlabel('Average speed (mph)')
    plt.ylabel('Parts')