Pyplot labels in scientific vs plain format

Dear all,
I’m fighting with pyplot labels in julia. I have to plot in a graph certain quantities that are in value very close to the value 104.6, with small differences in the second, third decimals. The fact is that I get the ugly behaviour of having labels in scientific notation, with a major value of 1.04E2 on the top right corner, and values of 0.00 0.02 0.04 etc on the axis labels. But that interferes with the title of the plot and lokks quite odd. Is there a way to tell the y-axis labels to plot exactly the numbers in plain format, i.e, not scientific one?

Example comes here:

data      = zeros(8,2)
data[:,1] = [8. 16. 32. 64. 128. 256. 512. 1024]
data[:,2] = 104.6 + 0.3*rand(8)

clf(); # clear current plot

fig    = figure( figsize=(6,4) );
ax     = gca() # Get the handle of the current axis

ax[:ticklabel_format](style="plain",axis="y")

title("AIS - samples of log(Z) with [0,1] units")
xlabel("beta");
ylabel("log(Z)");

x_plot = data[:,1]
y_plot = data[:,2]

scatter(x_plot,y_plot,color="black")

and the result

image

Thx for your help,

Ferran.

I cannot reproduce the problem with the standard installation. Can you show us the versions you are using?

I get 2.2.3 for PyPlot.version (which refers to the matplotlib version) and Julia 1.0. And here is how it looks like (for Julia 1.0 you have to broadcast the + with .+):

plot

The setting for the “scientific notation offset” is done with ax[:ticklabel_format](useOffset=false) btw., but even if I set useOffset=true, I don’t get that notation…

1 Like

The notation kicks in for bigger numbers.

data[:,2] = 10000104.6 .+ 0.3*rand(8)

With offset:

ax[:ticklabel_format](style="plain",axis="y", useOffset=true)

with_offset

Without offset:

ax[:ticklabel_format](style="plain",axis="y", useOffset=false)

without_offset