You want to call "set_yscale('symlog')" on the axes.


On 08/19/2011 01:07 PM, Jonny Milliken wrote:

I am having some trouble establishing how to use matplotlib.scale.SymmetricalLogScale() to draw a log scale on the positive and negative axis of a plot. Assuming of course that is the correct way to go about it

The code at the moment I am looking at goes something like this, with arbitrary data generated. I need SubplotHost for parasite axis later on.


import matplotlib
import pylab
import numpy
from mpl_toolkits.axes_grid.parasite_axes import SubplotHost

fig = pylab.figure(1)
main = SubplotHost(fig,111)

x,y = []
for i in range(100):
y.append(numpy.random.rand() * 100)
y.append(-numpy.random.rand() * 100)

x = range(len(y))



At this point I was expecting to be able to run with SymmetricalLogScale in the same way main.set_yscale('log') transforms after the plot but could not work out how to transform it other than:

main.yaxis = matplotlib.scale.SymmetricalLogScale(main.yaxis)

But that obviously didnt work, since SymmetricalLogScale doesnt have get_scale

If anyone could shed some light on the way to invoke this I'd be much obliged!? I havent been able to find an example of it's usage anywhere


------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it.
_______________________________________________ Matplotlib-users mailing list