4

I am currently trying to plot a scatter of two variables with a log scale in the x-axis. However, I'd like that the x-axis labels are not shown in scientific notation but just plain numbers. Here is the example code:

df2 = pd.DataFrame(np.array([[0.1, 10, 100], [4, 5, 6], [7, 8, 9]]),
                   columns=['a', 'b', 'c'])

f, ax = plt.subplots()
ax.set_xscale('log')

splot = sns.scatterplot( x="a",
           y="b",
           data=df2)


plt.figure(figsize=(12, 12), 
           dpi = 600) 
plt.show()

That displays the x-axis in 10^-1, 10^, 10^1 format, whereas I'd prefer 0.1, 10, 100 and so on. I tried to add a line such as:

ax.ticklabel_format(useOffset=False, style='plain')

but then I get an error such as: AttributeError: 'LogFormatterSciNotation' object has no attribute 'set_useOffset'. Any ideas on how to get around this?

Marc
  • 73
  • 6

0 Answers0