Hello Chris,
Hello list,

On Thursday 27 March 2008 18:26, Chris Withers wrote:
> Matthias Michler wrote:
> > I'm not sure that I understand you correctly. The code I refering is the
> > one which I attached some mails ago. The following works for me:
>
> Ah, okay, to get the problem I was having, change your script as follows:
> > -------------------------------------------------------------------------
> >-------- from pylab import *
> >
>  > from datetime import datetime
> >
> > from time import sleep
> >
> > ion()                     # interactive mode 'on'
> > figure()
> > ax = subplot(111, autoscale_on=True)
> >
> > x, y = [datetime.now()], [0]
> > line = plot(x, y, label="my_data")[0]
> >                                     # get the line-object as the first
> > element # of the tuple returned by plot legend()
> > for i in arange(30):
> >     x.append(datetime.now())           # append new values
> >     y.append(i**2)
> >     line.set_data(x,y)    # reset data
> >     ax.relim()            # reset axes limits
> >     ax.autoscale_view()   # rescale axes
> >     draw()                # redraw current figure
> >     sleep(0.3)            # wait 0.3 seconds
> >
> > ioff()
> > show()
>
> So, basically make the x axis time instead of numbers.
> I think the problem is actually that the daets are quite long in their
> format. If they were rotated through 90 degress it'd likely be fine.
> How would I do this?

I'm not sure it is the easiest way, but it works for me:

for label in ax.xaxis.get_majorticklabels():
    label.set_rotation(+90)

> Also, how would I get this kind of updating with bar charts or errorbars?

In the case of bar charts and errorbars it is quite difficult to reset the 
data.  
e.g. errobar (from the docstring) 
Return value is a length 3 tuple.  The first element is the
    Line2D instance for the y symbol lines.  The second element is
    a list of error bar cap lines, the third element is a list of
    line collections for the horizontal and vertical error ranges
I think it is quite expensive to reset all x/ydata of the lines by yourself 
and I have no idea how to reset data of line collections.

I would replot the errorbars, but maybe somebody else knows a good way to 
reset the data of errorbars.

regards 
Matthias

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to