From: Timo Heine <timo.heine@gm...>  20100304 08:10:15
Attachments:
Message as HTML

Hello, I'v made a small program which plots data from a CANbus log file. Some of the data to plot is logical type on/off values (bit on or off). I have tried to find a way to plot this kind of data with no success. Basically what I want to do is to draw a horizontal line with relative y coordinates and absolute xmin and xmax coordinate. Then I could draw a line when a bit is high and have it always in plot area even when zooming etc. Like axhline(...) but with relative y and absolute x coordinates. Another way to do this could be using subplots, but I can't figure out how to use same xscale on the both plots. Any suggestions? Best Regards Timo 
From: Friedrich Romstedt <friedrichromstedt@gm...>  20100304 18:36:16
Attachments:
Bits.png

Do you want something like the attached? I created it with my package that noone wants :( >>> import diagram_cl >>> import diagram_cl.kernels.tk >>> import numpy >>> import Tkinter >>> d1 = diagram_cl.Diagram() >>> series = (numpy.random.random(100) > 0.5).astype(numpy.float) >>> for idx in xrange(0, len(series)): ... layer = diagram_cl.Layer2D(x = [0, series[idx]], y = [idx, idx], color = 'blue') ... d1.add_layer(layer) ... >>> tk = Tkinter.Tk() >>> k1 = diagram_cl.kernels.tk.Diagram(tk, d1) Doubleright click on the figure, "Save", 200x200, "Bits.png". But of course, you can also do it with normal matplotlib (I'm not used to the pyplot things though, I'm rather using purist's API): Hmm, that's why it would be not the standard way to do it, so can anyone else post pure matplotlib means? Friedrich 
From: JaeJoon Lee <lee.joon@gm...>  20100304 19:59:38

Not sure what exactly you want. Is this close? ax = subplot(111) tr = ax.get_xaxis_transform() ax.plot([0.2, 0.8], [0.5, 0.5], transform=tr) The xcoodinate is in data coordinate, but y coordinate is in (normalized) axes coordinate. More about the transforms behind matplotlib can be found in http://matplotlib.sourceforge.net/trunkdocs/users/transforms_tutorial.html JJ On Thu, Mar 4, 2010 at 3:10 AM, Timo Heine <timo.heine@...> wrote: > Hello, > I'v made a small program which plots data from a CANbus log file. Some of > the data to plot is logical type on/off values (bit on or off). I have tried > to find a way to plot this kind of data with no success. > Basically what I want to do is to draw a horizontal line with relative y > coordinates and absolute xmin and xmax coordinate. Then I could draw a > line when a bit is high and have it always in plot area even when zooming > etc. Like axhline(...) but with relative y and absolute x > coordinates. Another way to do this could be using subplots, but I can't > figure out how to use same xscale on the both plots. > Any suggestions? > Best Regards > Timo >  > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and finetune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intelswdev > _______________________________________________ > Matplotlibusers mailing list > Matplotlibusers@... > https://lists.sourceforge.net/lists/listinfo/matplotlibusers > > 
From: Friedrich Romstedt <friedrichromstedt@gm...>  20100318 22:01:18

2010/3/4 Timo Heine <timo.heine@...>: > Basically what I want to do is to draw a horizontal line with relative y > coordinates and absolute xmin and xmax coordinate. Then I could draw a > line when a bit is high and have it always in plot area even when zooming > etc. Like axhline(...) but with relative y and absolute x > coordinates. I found a better solution candidate now, but I don't know whether it works: import matplotlib.transforms import matplotlib.lines <create Axes instance by calling fig.add_axes() or fig.add_subplot()> trans = matplotlib.transforms.blended_transform_factory(axes.transData, axes.transAxes) line = matplotlib.lines.Line2D([xmin, xmax], [yrel, yrel], transform = trans, <whatever like color = 'r'>) line.y_isdata = False axes.add_line(line) The code is taken from axes.py:Axes.axhline() with some alterations. Friedrich 