Search code examples
pythonseabornpairplot

How to adjust the pairplot y-axis tick format


I want the y-axis to be able to display the actual price instead of values with decimals going only up to one.

sns.pairplot(train,
             x_vars=['distance_travelled(kms)', 'car_age', 'year', 'brand_rank'],
             y_vars='price',
             height=5,
             aspect=0.7);

train is the name of the df.

This is the visualization I keep getting instead of the actual values:

A view of the information in the dataset:


Solution

  • I got this working by doing this

    g = sns.pairplot(train, x_vars=['distance_travelled(kms)','car_age', 'year','brand_rank'], y_vars= 'price', height= 5, aspect= 0.7);
    for ax in g.axes.flatten():
      ax.yaxis.get_major_formatter().set_scientific(False)
      ax.yaxis.get_major_formatter().set_useOffset(False)
    plt.show()  
    

    Didnt have the dataframe, so just made a dummy. But should work for you