get_tick{label}s: are tick labels drawn?

Hi,

say, is there a way to query an axis object whether or not the tick
labels are drawn?

I looked at -- one the x-axis -- get_xticks( and get_xticklabels()
which in two different situations would spit out a list of doubles
(the tick positions) and a list of text entries of the form
Text(0,0,''). In one plot, though, the tick labels are drawn, not in
the other one.

Cheers,
Nico

I just noticed something else now:

When tick labels are explicitly supplied, that may not actually
reflect in the return result of get_ticks. Specifically, I set the
tick labels in a color bar, but get_ticklabels() returns a list of
empty text objects Text(0,0,'').
For regular axes, that seems to work better.

Bug?

Cheers,
Nico

···

On Sat, May 8, 2010 at 10:36 AM, Nico Schlömer <nico.schloemer@...287...> wrote:

Hi,

say, is there a way to query an axis object whether or not the tick
labels are drawn?

I looked at -- one the x-axis -- get_xticks( and get_xticklabels()
which in two different situations would spit out a list of doubles
(the tick positions) and a list of text entries of the form
Text(0,0,''). In one plot, though, the tick labels are drawn, not in
the other one.

Cheers,
Nico

Like the gridlines, these are determined during the drawing time.

Each tick instances have

tick1On
tick2On
label1On
label2On

attributes that controls whether to draw tick (or ticklabel) or not.
Again, note that not all ticks that are returned by get_xticks()
methods may be actually drawn.

-JJ

···

On Sat, May 8, 2010 at 4:36 AM, Nico Schlömer <nico.schloemer@...1896....> wrote:

Hi,

say, is there a way to query an axis object whether or not the tick
labels are drawn?

I looked at -- one the x-axis -- get_xticks( and get_xticklabels()
which in two different situations would spit out a list of doubles
(the tick positions) and a list of text entries of the form
Text(0,0,''). In one plot, though, the tick labels are drawn, not in
the other one.

Cheers,
Nico

------------------------------------------------------------------------------

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

I mean, even if their tick1On (and others) is True.

-JJ

···

On Thu, May 20, 2010 at 3:17 PM, Jae-Joon Lee <lee.j.joon@...287...> wrote:

Again, note that not all ticks that are returned by get_xticks()
methods may be actually drawn.

How did you set your ticklabels?
Again, matplotlib does not guarantee that all ticks that are returned
by get_ticks() will be actually drawn. On other words, get_ticks may
return ticks that are meaningless (and this is not a bug).
Also, colorbar axes works slightly differently from normal axes, but
I'm not sure if this is related with your problem.

As far as I can say, the use of get_ticks(), get_ticklabels() and etc
method should be limited to when you want to view/change their artist
attributes (like colors, etc.). You should not rely on this to
determine things like, whether some ticks will be drawn, locations of
ticks, and etc.

-JJ

···

On Mon, May 10, 2010 at 12:19 PM, Nico Schlömer <nico.schloemer@...287...> wrote:

When tick labels are explicitly supplied, that may not actually
reflect in the return result of get_ticks. Specifically, I set the
tick labels in a color bar, but get_ticklabels() returns a list of
empty text objects Text(0,0,'').
For regular axes, that seems to work better.