On Tue, Dec 6, 2011 at 10:08 AM, Arnaud <arnaud.legen...@rhenovia.com>wrote:
> Hello,
>
> i encountered a problem when trying to set axes as logarithmic in a 3D
> plot using plot_surface().
>
> I do not know if it is a known bug or if it is a workaround ...?
>
Yes, this is a known bug and it is a very tricky one to untangle. My only
suggestion is to plot the function using linearized log values. So, maybe
something like this:
#!/usr/bin/python
import os
import sys
from pylab import *
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import axes3d
import numpy as np
# parameters we bach on
X = np.log10(np.arange(0.1, 20, 0.5))
Y = np.log10(np.arange(0.1, 20, 0.5))
X, Y = np.meshgrid(X, Y)
R = np.sqrt((10**X-10)**2 + (10**Y-10)**2)
Z = np.sin(R)
fig = figure(num=None, figsize=(6, 6), dpi=80, facecolor='#F2F2F2',
edgecolor='k')
ax = subplot(111,projection='3d')
ax.plot_surface(X,Y,Z, rstride=1, cstride=1, cmap=cm.jet, linewidths=.5)
show()
Now, that won't make the points evenly spaced, so you might want to do
something like the following:
X = np.log10(np.logspace(-1, 1.3, 40))
I hope that helps!
Ben Root
------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of
discussion for anyone considering optimizing the pricing and packaging model
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users