Symmetrical Log Scale on Axis

Hi,

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)

fig.add_subplot(main)

x,y = []

for i in range(100):

y.append(numpy.random.rand())

y.append(-numpy.random.rand())

y.append(numpy.random.rand() * 100)

y.append(-numpy.random.rand() * 100)

x = range(len(y))

main.plot(x,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

Cheers

Jonny

You want to call “set_yscale(‘symlog’)” on the axes.

Mike
···

http://p.sf.net/sfu/wandisco-d2d-2


Matplotlib-users@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-users