pylab plot_date problem

Discussion in 'Python' started by Shah Sultan Alam, Mar 19, 2009.

  1. Hi ,
    I am using following code to create a graph
    def plot_plot():
    ax = pylab.subplot(111)
    for count in range(len(yaxes_values)):
    pylab.subplots_adjust(left=0.13, bottom=0.21,
    right=0.90, top=0.90,wspace=0.20, hspace=0.20)

    ax.plot_date(id_dates,yaxes_values[count],fmt='o-',label=titleList[count])
    pylab.xlabel('Time Stamp')
    pylab.ylabel('Values')


    ax.xaxis.set_major_locator(pylab.MinuteLocator(interval=Interval))
    ax.xaxis.set_major_formatter(formatter)
    labels = ax.get_xticklabels()
    pylab.setp(labels, rotation=90, fontsize=8)
    ax.set_title(choice)
    pylab.grid()
    font= FontProperties(size='x-small');
    pylab.legend(loc=0, prop=font)


    each time I am re-initilliziing the "titleList" before calling the
    plot_plot , This works fine for one graph,
    But if I call it more then once the label keep appending ..
    How to get rid of this ?

    Regds
    Shah Alam
    Shah Sultan Alam, Mar 19, 2009
    #1
    1. Advertising

  2. Shah Sultan Alam

    pylatino Guest

    On Mar 19, 2:02 am, Shah Sultan Alam <> wrote:
    > Hi ,
    >  I am using following code to create a graph
    > def plot_plot():
    >   ax = pylab.subplot(111)
    >         for count in range(len(yaxes_values)):
    >                 pylab.subplots_adjust(left=0.13, bottom=0.21,
    > right=0.90, top=0.90,wspace=0.20, hspace=0.20)
    >
    > ax.plot_date(id_dates,yaxes_values[count],fmt='o-',label=titleList[count])
    >                 pylab.xlabel('Time Stamp')
    >                 pylab.ylabel('Values')
    >
    > ax.xaxis.set_major_locator(pylab.MinuteLocator(interval=Interval))
    >                 ax.xaxis.set_major_formatter(formatter)
    >                 labels = ax.get_xticklabels()
    >                 pylab.setp(labels, rotation=90, fontsize=8)
    >                 ax.set_title(choice)
    >         pylab.grid()
    >         font= FontProperties(size='x-small');
    >         pylab.legend(loc=0, prop=font)
    >
    > each time I am re-initilliziing the "titleList" before calling the
    > plot_plot , This works fine for one graph,
    > But if I call it more then once the label keep appending ..
    > How to get rid of this ?
    >
    > Regds
    > Shah Alam


    Just a random thought, though I don't have experience with the module
    pylab and the function titleList, it sounds like you need to
    initialize the titleList inside the same plot_plot() function, rather
    than from outside. I would say try:
    >ax.plot_date(id_dates,yaxes_values[count],fmt='o-',label=titleList[count])
    > pylab.xlabel('Time Stamp')
    > pylab.ylabel('Values')
    >titleList[count]='' #or [] if it is a multivalued variable.


    Hope it helps,
    Omar
    pylatino, Mar 20, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    521
    Istvan Albert
    Jan 19, 2005
  2. Dr. Colombes
    Replies:
    3
    Views:
    663
    John Hunter
    Feb 23, 2005
  3. Replies:
    0
    Views:
    328
  4. Charles Krug
    Replies:
    2
    Views:
    5,342
    Charles Krug
    Apr 28, 2005
  5. Jan Wienhausen

    pylab: plot update

    Jan Wienhausen, May 11, 2005, in forum: Python
    Replies:
    1
    Views:
    680
    Skip Montanaro
    May 11, 2005
Loading...

Share This Page