Hi folks,

I have a few plots which I would like to stack in a single figure. When
I first came with this problem (back to matplotlib version 0.93 or
older), the most efficient way (at least in my case) of doing this
consisted in playing with transformations as you can see in the cookbook
(see:
http://www.scipy.org/Cookbook/Matplotlib/MultilinePlots#head-b5f2ad87ab7ec637a0fc63ec85281469d9aeeb46).
Unfortunately, this example (and, of course, the script I wrote back
then) doesn't work anymore with with the newest version of Matplotlib
(0.98).
So I started to hack the "mri_with_eeg.py" example to achieve what I
want (since the way EEGs are stacked!)... with no luck!
I probably don't understand well how the transformation works... That's
why I decided to beg for a friendly help! :)

Here is the code from the example (I focused on the lines I haven't
completely figured):

    boxin = Bbox.from_extents(ax.viewLim.x0, -20, ax.viewLim.x1, 20)

    height = ax.bbox.height
    boxout = Bbox.from_extents(ax.bbox.x0, -1.0 * height,
                               ax.bbox.x1,  1.0 * height)

    transOffset = BboxTransformTo(
        Bbox.from_extents(0.0, ax.bbox.y0, 1.0, ax.bbox.y1))


    for i in range(numRows):
        # effectively a copy of transData
        trans = BboxTransform(boxin, boxout)
        offset = (i+1)/(numRows+1)

        trans += Affine2D().translate(*transOffset.transform_point((0,
offset)))

        thisLine = Line2D(
            t, data[:,i]-data[0,i],
            )

        thisLine.set_transform(trans)

        ax.add_line(thisLine)
        ticklocs.append(offset)

ax being a AxesSubplot instance
as far as I understood, 20 and -20 (see line where boxin is defined)
refer to min and max values (on Y axis) to be plotted within the space
allocated to each plot (thanks to the tranformation named trans).
In my case Y values can be much higher (roughly from -1e3 to 5e7), so I
should change those values according to mine in order to get the
tranformation working for me. Obviously something is wrong in my
understanding since it doesn't work!
Hence my first question: Why is it not working?
As a bonus, I also have another question: Is there a "new" (i.e.
provided by the new API) way that can be used to stack plots composed by
many (>5k) points?

Thanks

Sébastien

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to