how to use transforms to rotate and shift a group of objects

Hi,

I'd like to plot several objects which are defined in coordinate systems which are local to each object in a common plot.
The objects (and the corresponding local coordinate systems) are rotated and translated wrt. a global reference point.

I tried something like

r = matplotlib.transforms.Affine2D().rotate_deg(90)
matplotlib.pyplot.plot(x, y, transform = r)

but this didn't work.

Additionally to matplotlib.pyplot.plot I use also matplotlib.patches.PathPatch, matplotlib.pyplot.plot to draw shapes and text.

Any help on how to rotate (and shift) a whole assembly which contains eg. a matplotlib.patches.PathPatch and an annotation would be helpful.

regards,

···

--
Johannes

Have you read through the transformation tutorial?
http://matplotlib.org/users/transforms_tutorial.html

There is a section on how to do a shadow transformation that might be helpful. Obviously, you wouldn’t need to create the second artist, but it does show how to customize the transform on a per-artist basis.

Others might be able to provide better insight on whether or not there are easier ways to do what you want.

Cheers!
Ben Root

···

On Wed, Jul 16, 2014 at 10:11 AM, Dr. Johannes Zellner <johannes@…4554…> wrote:

Hi,

I’d like to plot several objects which are defined in coordinate systems

which are local to each object in a common plot.

The objects (and the corresponding local coordinate systems) are rotated

and translated wrt. a global reference point.

I tried something like

r = matplotlib.transforms.Affine2D().rotate_deg(90)

matplotlib.pyplot.plot(x, y, transform = r)

but this didn’t work.

Additionally to matplotlib.pyplot.plot I use also

matplotlib.patches.PathPatch, matplotlib.pyplot.plot to draw shapes and

text.

Any help on how to rotate (and shift) a whole assembly which contains

eg. a matplotlib.patches.PathPatch and an annotation would be helpful.

regards,

Johannes


Want fast and easy access to all the code in your enterprise? Index and

search up to 200,000 lines of code with a free copy of Black Duck

Code Sight - the same software that powers the world’s largest code

search on Ohloh, the Black Duck Open Hub! Try it now.

http://p.sf.net/sfu/bds


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users