# 3d plot scientific notation problem on x and y axis.

I am trying to show the numbers at x and y axis in scientific notation but it does not work.
Can anyone help me.
Here is the code and fs is 60 000 000.

from matplotlib.ticker import ScalarFormatter

formatter = ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
formatter.set_powerlimits((-1,3))

fig1 = plt.figure()
ax1 = fig1.gca(projection=‘3d’, azim=0)
ax1.xaxis.set_major_formatter(formatter)

ax1.yaxis.set_major_formatter(formatter)

tau_val, freq_val = npy.meshgrid(npy.float64(tau_val)/fs, npy.float64(freq_val)*fs)
ax1.plot_surface(tau_val, freq_val, caf, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=False)

plt.show()

Burak,

This is because in an Axes3D object, the .xaxis and .yaxis refer to the axis for the draw space, not the the 3d projected axis. I know it is confusing, but the axis objects that you want are called “.w_xaxis” and “.w_yaxis” and “.w_zaxis”.

I hope that helps!
Ben Root

···

On Sun, Oct 10, 2010 at 8:54 PM, Burak TUYSUZ <bzt110@…211…> wrote:

I am trying to show the numbers at x and y axis in scientific notation but it does not work.
Can anyone help me.
Here is the code and fs is 60 000 000.

from matplotlib.ticker import ScalarFormatter

formatter = ScalarFormatter(useMathText=True)
formatter.set_scientific(True)
formatter.set_powerlimits((-1,3))

fig1 = plt.figure()
ax1 = fig1.gca(projection=‘3d’, azim=0)
ax1.xaxis.set_major_formatter(formatter)

ax1.yaxis.set_major_formatter(formatter)

tau_val, freq_val = npy.meshgrid(npy.float64(tau_val)/fs, npy.float64(freq_val)*fs)
ax1.plot_surface(tau_val, freq_val, caf, rstride=1, cstride=1, cmap=cm.jet, linewidth=0, antialiased=False)

plt.show()