[Matplotlib-users] rotated axes within figure.

Joe Kington joferkington at gmail.com
Mon Feb 29 07:16:11 EST 2016


For what it's worth, if you don't mind having fixed extents, you can use
axisartist for this.

There's an example of it in the axisartist examples and a simplified
version here: http://stackoverflow.com/a/21654433/325565

Hope that helps!
-Joe
On Feb 29, 2016 2:42 AM, "Gustavo Goretkin" <gustavo.goretkin at gmail.com>
wrote:

> Alright, this was my shot at it:
> https://gist.github.com/goretkin/d34f287062f6b27e8846
>
> It seems like the assumption of an  axis-aligned axes is baked in pretty
> strongly, and maybe that's for the best...
>
> I couldn't figure out how tick lines work and why they weren't rotated.
> The Line2D object has the correct transform. They are lines whose xy_data
> contain only one coordinate, though something must specify the other end of
> the tick line (what gives it its length otherwise?) and that is assuming
> that the axes is axis-aligned.
>
>
> In [4]: [l.get_xydata() for l in ax.xaxis.get_ticklines()]
> Out[4]:
> [array([[ 0.,  0.]]),
>  array([[ 0.,  1.]]),
>  array([[ 2.,  0.]]),
>  array([[ 2.,  1.]]),
>  array([[ 4.,  0.]]),
>  array([[ 4.,  1.]]),
>  array([[ 6.,  0.]]),
>  array([[ 6.,  1.]]),
>  array([[ 8.,  0.]]),
>  array([[ 8.,  1.]]),
>  array([[ 10.,   0.]]),
>  array([[ 10.,   1.]]),
>  array([[ 12.,   0.]]),
>  array([[ 12.,   1.]])]
>
>
>
> On Fri, Feb 26, 2016 at 3:12 PM, Gustavo Goretkin <
> gustavo.goretkin at gmail.com> wrote:
>
>> Hello,
>>
>> (sorry if you get this message twice. I originally posted to the old
>> sourceforge list)
>>
>> How can I add an axes to a figure, but specify the transform from axes
>> coordinates to figure coordinates? I want a set of axes (ticks, spines,
>> data, everything) that are rotated?
>>
>> Figure.add_axes [1] accepts a box left-bottom-width-height axis aligned
>> box specification. I can't follow in the code where a transform is made out
>> of that, but I basically want a generic transform. Do tick labels, ticks,
>> titles, etc. assume that the axes-to-figure transform is purely a
>> translation?
>>
>>
>> [1]
>> https://github.com/matplotlib/matplotlib/blob/e12d103a11cd08adbed348547bdb8182e414e0bb/lib/matplotlib/figure.py#L840
>>
>> Thanks,
>> Gustavo
>>
>
>
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users at python.org
> https://mail.python.org/mailman/listinfo/matplotlib-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20160229/ee995805/attachment.html>


More information about the Matplotlib-users mailing list