1

I am trying to set my plot with custom axis tick labels and I want my x-axis, y-axis limit range to be same. In the image the y-axis maximum value is 31622776 and I want to extend the y-axis to 100000000 (same as x-axis). The code I used is

ax = sns.scatterplot(x="Actual", y="Predict",hue="Flag",style="Flag",data=df)
x_labels = {31622 : 4.5 , 100000 : 5 ,316227 : 5.5 ,1000000 : 6 ,3162277 : 6.5 ,10000000 : 7 ,31622776 : 7.5, 100000000 : 8}     
ax.set_xticklabels(x_labels)
y_labels = {31622 : 4.5 , 100000 : 5 ,316227 : 5.5 ,1000000 : 6 ,3162277 : 6.5 ,10000000 : 7 ,31622776 : 7.5 , 100000000 : 8}
ax.set_yticklabels(y_labels)
plt.title(r'Log-Log plot of Actual Sales Price Vs Predicted Sales Price')
plt.xlabel(r'Actual Sales Price in Dollars')
plt.ylabel(r'Predicted Sales Price in Dollars')

enter image description here

I am confused about what change I should make to achieve it.

0

1 Answer 1

1

Use matplotlib.pyplot.xlim() / .ylim() in addition to setting tick labels. Tick labels won't automatically change the axis scaling.

See: https://matplotlib.org/api/_as_gen/matplotlib.pyplot.xlim.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.