1

I'm trying to plot some house price data so imagine in the 100,000 - 300,000 range, but my Y axis keeps defaulting to scientific notation.

reading.plot(kind='scatter', x='Transaction Date',y='Price Paid', alpha=0.1, c='green', ylim=(0,2000000))

Is there an extra variable I should be adding?

Thanks in advance!

Rich

Scatterplot

Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214
Richard
  • 11
  • 2
  • Welcome to SO Richard. If you are using mathplotlib then you can use a `ticklabel_format` `style=plain`. – Mike Poole Sep 22 '20 at 10:03
  • 2
    Does this answer your question? [prevent scientific notation in matplotlib.pyplot](https://stackoverflow.com/questions/28371674/prevent-scientific-notation-in-matplotlib-pyplot) – Tomerikoo Sep 22 '20 at 10:13

1 Answers1

0

try this:

import matplotlib.pyplot as plt
fig, ax =  plt.subplots()
reading.plot(kind='scatter', x='Transaction Date',y='Price Paid', alpha=0.1, c='green', ylim=(0,2000000), ax=ax)
ax.ticklabel_format(style='plain')
plt.show()
Ajay Verma
  • 610
  • 2
  • 12
  • Thanks - just tried it and weirdly got this error? AttributeError: This method only works with the ScalarFormatter Does this mean anything to you? Thanks again! – Richard Sep 22 '20 at 18:03
  • can you try using plt.ticklabel_format(style='plain', axis='y'), instead of ax.ticklabel_format(style='plain') I don't know exactly the reason for the error you are getting (as I am not able to reproduce the error on sample data) – Ajay Verma Sep 22 '20 at 18:28
  • Also take a look at this question which mentions the same error you are getting: – Ajay Verma Sep 22 '20 at 18:30
  • plt.ticklabel_format(style='plain', axis='y') worked! thank you so much! Is there a specific reason to why it's doing this? – Richard Sep 24 '20 at 21:37