I have some problems to plot a 3d plot_surface (and contour plot) in log scale (y and z or x,y and z).
There is nothink in the help sections of thus plot to plot them in log scale (neither in thus plot code commentary).
I tried to find a solution by myself (many try as “log=True”, “xscale=‘log’”, “scale=‘log’”, or “set_xscale(‘log’)”…) but it doesn’t work.
I tried to use “LogFormatter” (ticker) but i failed (maybe I am doing something wrong (I am a newbe) but i tried many things).
I try to found a solution on forums and this mailing list and what i found nearest of my problem is this topic:
They said this problem had no solution. Is it true? have somebody solved this problem?
An other solution is to plot log(Data) and change ticks with “set_ticks” (for exemple) but it seems to only work with 2D plot. I tried too
To be unterstanding easier, this is an exemple of the code to plot in log scale:
import matplotlib.pyplot as plt# (i am under ‘1.0.0’)
import numpy as np
#Data x = np.logspace(0, 4, 10) y = np.logspace(0, 4, 10) Z = np.arange(100).reshape((10,10)) #Min and Max for x,y and Z minx=np.min(x) maxx=np.max(x) miny=np.min(y) maxy=np.max(y) minz=np.min(Z) maxz=np.max(Z) #figure fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_surface(X, Y, Z, rstride=8, cstride=8, alpha=0.3) cset = ax.contour(X, Y, Z, zdir='z', offset=minz) cset = ax.contour(X, Y, Z, zdir='x', offset=minx) cset = ax.contour(X, Y, Z, zdir='y', offset=miny) ax.set_xlabel("X") ax.set_xlim3d(minx,maxx) ax.set_ylabel("Y") ax.set_ylim3d(miny,maxy) ax.set_zlabel("Z") ax.set_zlim3d(minz,maxz) fig.savefig("plot00.png")
Has someone got a solution?