Multiple y axis plotting

Hi new to Matplotlib and struggling to make a plot that

    > has three lines plotted on it: two are supposed to plot on
    > the LH y axis and the third on the RH y axis. The code so
    > far is

         ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])
         ax2 = fig.add_axes([0.9, 0.1, -0.8, 0.8])
                                         ^
                            [left, bottom, width, height]

negative numbers are not supported. I don't know what kind of layout
you want, but start with something like

         ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.8])
         ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.8])

and once you have a working plot tweak from there.

JDH

John

am trying to make a plot something along the lines of the attached. This has a single plot area with separate y-axes on either side of the plot, rather than two plot areas, each with their own axis

Best regards

Alun Griffiths

example_plot.pdf (13.1 KB)

···

At 14:24 06/11/2006, John Hunter wrote:

    > Hi new to Matplotlib and struggling to make a plot that
    > has three lines plotted on it: two are supposed to plot on
    > the LH y axis and the third on the RH y axis. The code so
    > far is

         ax1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])
         ax2 = fig.add_axes([0.9, 0.1, -0.8, 0.8])
                                         ^
                            [left, bottom, width, height]

negative numbers are not supported. I don't know what kind of layout
you want, but start with something like

         ax1 = fig.add_axes([0.1, 0.1, 0.4, 0.8])
         ax2 = fig.add_axes([0.55, 0.1, 0.4, 0.8])

and once you have a working plot tweak from there.

JDH

After poking around in the Pylab source, managed to sort the multiple line plotting using

fig = self.get_figure()
ax1 = fig.gca()
ax2 = fig.add_axes(ax1.get_position(), sharex=ax1, frameon=False)

so issue closed for the moment