Hello:

I am having some trouble with the syntax for plotting using matplotlib. I 
have appended a simple script which illustrates the problem. When I run 
the script the first plot command gives the expected results but the 
second, third and fourth plot commands do not. The second window does 
open but no plots are contained within. However if I read the script 
again (run ....) but do not call the function (main()) then the plots for 
the second window appear (but the plot in the first window does not get 
the second plot).

Any help?

#!/usr/bin/env ipython

from __future__ import division

import numpy as np
import scipy as sp
#import matplotlib.pyplot as plt
import matplotlib.pylab as plt

def main():

        a = np.array([1,2,3])
        b = np.array(([100,200,300],[400,500,600],[700,800,900]))

        fig1 = plt.figure(1)

        ax1 = fig1.add_subplot(111)
        ax1.plot(a)
        ax1.set_xlabel('x')
        ax1.set_ylabel('y')

        ax2 = plt.twinx()
        ax2.plot(b[:,:])
        ax2.set_ylabel('x')
        ax2.yaxis.tick_right()

        fig2 = plt.figure(2)

        ax3 = fig2.add_subplot(211)
        ax3.plot(a)
        ax3.set_xlabel('x')
        ax3.set_ylabel('y')

        ax4 = fig2.add_subplot(212)
        ax4.plot(b[1,:])
        ax4.set_xlabel('x')
        ax4.set_ylabel('y')

        plt.show()

        return


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to