accessing axis artist objects for an axes object

Python: 3.5
Matplotlib: 1.5.2

I'm trying to invert the tick labels on a Cartopy map, and I found
this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:
http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that I've
experimented with says that the axis attribute is a *method*, not a
sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike

ax.xaxis or ax.yaxis

axes_grid is an alternative to the default Axes/Axis classes.

Tom

···

On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@…924…> wrote:

Python: 3.5

Matplotlib: 1.5.2

I’m trying to invert the tick labels on a Cartopy map, and I found

this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:

http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that I’ve

experimented with says that the axis attribute is a method, not a

sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike



Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

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

Thomas - I hate to be obtuse, but did you mean to imply that the xaxis
and yaxis properties of an Axes object are AxisArtist objects?
IPython tells me that they are XAxis and YAxis objects. From
inspecting the GitHub repo, it seems that these are child classes of
the Axis object.

I suppose I should ask the question addressing the problem I actually
have: How do I render the tick (map) labels *inside* a Cartopy map
instead of *outside*?

Thanks,

Mike

···

On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@...287...> wrote:

ax.xaxis or ax.yaxis

axes_grid is an alternative to the default Axes/Axis classes.

Tom

On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@...924...> wrote:

Python: 3.5
Matplotlib: 1.5.2

I'm trying to invert the tick labels on a Cartopy map, and I found
this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:
http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that I've
experimented with says that the axis attribute is a *method*, not a
sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I think you do that by setting a negative tickpad value in the rcParams.

···

On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike <mhearne@…924…> wrote:

Thomas - I hate to be obtuse, but did you mean to imply that the xaxis

and yaxis properties of an Axes object are AxisArtist objects?

IPython tells me that they are XAxis and YAxis objects. From

inspecting the GitHub repo, it seems that these are child classes of

the Axis object.

I suppose I should ask the question addressing the problem I actually

have: How do I render the tick (map) labels inside a Cartopy map

instead of outside?

Thanks,

Mike

On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@…287…> wrote:

ax.xaxis or ax.yaxis

axes_grid is an alternative to the default Axes/Axis classes.

Tom

On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@…924…> wrote:

Python: 3.5

Matplotlib: 1.5.2

I’m trying to invert the tick labels on a Cartopy map, and I found

this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:

http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that I’ve

experimented with says that the axis attribute is a method, not a

sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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

I couldn't find an rcParams property called "tickpad". I did find
"xtick.major.pad", which was set to 4.0. Setting it to a negative
value has no effect. xtick.minor.pad doesn't do anything either.

···

On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root <ben.v.root@...287...> wrote:

I think you do that by setting a negative tickpad value in the rcParams.

On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike <mhearne@...924...> wrote:

Thomas - I hate to be obtuse, but did you mean to imply that the xaxis
and yaxis properties of an Axes object are AxisArtist objects?
IPython tells me that they are XAxis and YAxis objects. From
inspecting the GitHub repo, it seems that these are child classes of
the Axis object.

I suppose I should ask the question addressing the problem I actually
have: How do I render the tick (map) labels *inside* a Cartopy map
instead of *outside*?

Thanks,

Mike

On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@...287...> wrote:
> ax.xaxis or ax.yaxis
>
> axes_grid is an alternative to the default Axes/Axis classes.
>
> Tom
>
>
> On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@...924...> wrote:
>>
>> Python: 3.5
>> Matplotlib: 1.5.2
>>
>> I'm trying to invert the tick labels on a Cartopy map, and I found
>> this Matplotlib example:
>>
>> ax.axis[:].invert_ticklabel_direction()
>>
>> found here:
>> http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html
>>
>> My problem is that any Axes object (or child class thereof) that I've
>> experimented with says that the axis attribute is a *method*, not a
>> sequence as I infer from the above example.
>>
>> How do I get the axisartists for a bog-standard Axes instance?
>>
>> Thanks in advance,
>>
>> Mike
>>
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> matplotlib-users List Signup and Options

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

Hmm, strange. Well, I know this works in mplot3d (we have a test for it)

for i, tick in enumerate(ax.yaxis.get_major_ticks()):
    tick.set_pad(tick.get_pad() - i * 5)

A bit silly, but it is how you can have labels anywhere you want relative to the ticks.

···

On Wed, Sep 7, 2016 at 11:47 AM, Hearne, Mike <mhearne@…924…> wrote:

I couldn’t find an rcParams property called “tickpad”. I did find

“xtick.major.pad”, which was set to 4.0. Setting it to a negative

value has no effect. xtick.minor.pad doesn’t do anything either.

On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root <ben.v.root@…287…> wrote:

I think you do that by setting a negative tickpad value in the rcParams.

On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike <mhearne@…924…> wrote:

Thomas - I hate to be obtuse, but did you mean to imply that the xaxis

and yaxis properties of an Axes object are AxisArtist objects?

IPython tells me that they are XAxis and YAxis objects. From

inspecting the GitHub repo, it seems that these are child classes of

the Axis object.

I suppose I should ask the question addressing the problem I actually

have: How do I render the tick (map) labels inside a Cartopy map

instead of outside?

Thanks,

Mike

On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@…287…> wrote:

ax.xaxis or ax.yaxis

axes_grid is an alternative to the default Axes/Axis classes.

Tom

On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@…924…> wrote:

Python: 3.5

Matplotlib: 1.5.2

I’m trying to invert the tick labels on a Cartopy map, and I found

this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:

http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that I’ve

experimented with says that the axis attribute is a method, not a

sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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

It turns out that the Cartopy gridline labels are NOT tick labels, but
Text objects managed by the Gridliner class. I think I'm just going
to draw the grid line labels myself.

···

On Wed, Sep 7, 2016 at 9:04 AM, Benjamin Root <ben.v.root@...287...> wrote:

Hmm, strange. Well, I know this works in mplot3d (we have a test for it)

    for i, tick in enumerate(ax.yaxis.get_major_ticks()):
        tick.set_pad(tick.get_pad() - i * 5)

A bit silly, but it is how you can have labels anywhere you want relative to
the ticks.

On Wed, Sep 7, 2016 at 11:47 AM, Hearne, Mike <mhearne@...924...> wrote:

I couldn't find an rcParams property called "tickpad". I did find
"xtick.major.pad", which was set to 4.0. Setting it to a negative
value has no effect. xtick.minor.pad doesn't do anything either.

On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root <ben.v.root@...287...> >> wrote:
> I think you do that by setting a negative tickpad value in the rcParams.
>
> On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike <mhearne@...924...> wrote:
>>
>> Thomas - I hate to be obtuse, but did you mean to imply that the xaxis
>> and yaxis properties of an Axes object are AxisArtist objects?
>> IPython tells me that they are XAxis and YAxis objects. From
>> inspecting the GitHub repo, it seems that these are child classes of
>> the Axis object.
>>
>> I suppose I should ask the question addressing the problem I actually
>> have: How do I render the tick (map) labels *inside* a Cartopy map
>> instead of *outside*?
>>
>> Thanks,
>>
>> Mike
>>
>> On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@...287...> >> >> wrote:
>> > ax.xaxis or ax.yaxis
>> >
>> > axes_grid is an alternative to the default Axes/Axis classes.
>> >
>> > Tom
>> >
>> >
>> > On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@...924...> wrote:
>> >>
>> >> Python: 3.5
>> >> Matplotlib: 1.5.2
>> >>
>> >> I'm trying to invert the tick labels on a Cartopy map, and I found
>> >> this Matplotlib example:
>> >>
>> >> ax.axis[:].invert_ticklabel_direction()
>> >>
>> >> found here:
>> >> http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html
>> >>
>> >> My problem is that any Axes object (or child class thereof) that
>> >> I've
>> >> experimented with says that the axis attribute is a *method*, not a
>> >> sequence as I infer from the above example.
>> >>
>> >> How do I get the axisartists for a bog-standard Axes instance?
>> >>
>> >> Thanks in advance,
>> >>
>> >> Mike
>> >>
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> _______________________________________________
>> >> Matplotlib-users mailing list
>> >> Matplotlib-users@lists.sourceforge.net
>> >> matplotlib-users List Signup and Options
>>
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> Matplotlib-users mailing list
>> Matplotlib-users@lists.sourceforge.net
>> matplotlib-users List Signup and Options
>
>

… or report it as a bug against Cartopy for not observing the pad rcParam?

···

On Wed, Sep 7, 2016 at 12:59 PM, Hearne, Mike <mhearne@…4718…> wrote:

It turns out that the Cartopy gridline labels are NOT tick labels, but

Text objects managed by the Gridliner class. I think I’m just going

to draw the grid line labels myself.

On Wed, Sep 7, 2016 at 9:04 AM, Benjamin Root <ben.v.root@…287…> wrote:

Hmm, strange. Well, I know this works in mplot3d (we have a test for it)

for i, tick in enumerate(ax.yaxis.get_major_ticks()):
    tick.set_pad(tick.get_pad() - i * 5)

A bit silly, but it is how you can have labels anywhere you want relative to

the ticks.

On Wed, Sep 7, 2016 at 11:47 AM, Hearne, Mike <mhearne@…924…> wrote:

I couldn’t find an rcParams property called “tickpad”. I did find

“xtick.major.pad”, which was set to 4.0. Setting it to a negative

value has no effect. xtick.minor.pad doesn’t do anything either.

On Wed, Sep 7, 2016 at 8:32 AM, Benjamin Root <ben.v.root@…287…>

wrote:

I think you do that by setting a negative tickpad value in the rcParams.

On Wed, Sep 7, 2016 at 11:28 AM, Hearne, Mike <mhearne@…924…> wrote:

Thomas - I hate to be obtuse, but did you mean to imply that the xaxis

and yaxis properties of an Axes object are AxisArtist objects?

IPython tells me that they are XAxis and YAxis objects. From

inspecting the GitHub repo, it seems that these are child classes of

the Axis object.

I suppose I should ask the question addressing the problem I actually

have: How do I render the tick (map) labels inside a Cartopy map

instead of outside?

Thanks,

Mike

On Tue, Sep 6, 2016 at 5:03 PM, Thomas Caswell <tcaswell@…287…>

wrote:

ax.xaxis or ax.yaxis

axes_grid is an alternative to the default Axes/Axis classes.

Tom

On Tue, Sep 6, 2016, 19:53 Hearne, Mike <mhearne@…924…> wrote:

Python: 3.5

Matplotlib: 1.5.2

I’m trying to invert the tick labels on a Cartopy map, and I found

this Matplotlib example:

ax.axis[:].invert_ticklabel_direction()

found here:

http://matplotlib.org/mpl_toolkits/axes_grid/users/axisartist.html

My problem is that any Axes object (or child class thereof) that

I’ve

experimented with says that the axis attribute is a method, not a

sequence as I infer from the above example.

How do I get the axisartists for a bog-standard Axes instance?

Thanks in advance,

Mike



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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



Matplotlib-users mailing list

Matplotlib-users@…1735…sourceforge.net

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