2011/2/14 Gaël KANEKO <kanekog...@hotmail.com>

>  Hi,
> 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:
>
> http://stackoverflow.com/questions/3909794/plotting-mplot3d-axes3d-xyz-surface-plot-with-log-scale
> ‏ 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?
> Thanks!
> Regards,
> Gaël
>
>
I can confirm (with a modified version of your script) that mplot3d does not
properly handle non-linear scaling.  While it is possible to set the axis
scale through a command like:

ax.w_xaxis.set_scale('log')

but the placement of the tickers are wrong and it fails because mplot3d does
some weird stuff with the ticker formatter rather than just letting the
formatter do its job.

I will look into this further to see if I can fix this.

Ben Root
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to