Skip to content

ticklabels empty when not interactive #6103

@ocehugo

Description

@ocehugo
  • [1.5.1,3.5.1,OSX] Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)
  • [pip ] How did you install Matplotlib and Python (pip, anaconda, from source ...)
from matplotlib.pyplot import subplots,gca

fig,ax = subplots()
ax.plot(range(0,10),range(0,10))
label_list = list(ax.xaxis.get_ticklabels())
print('First label is :',label_list[0].get_text())
label_list = list(ax.get_xaxis().get_ticklabels())
print('First label is :',label_list[0].get_text())
label_list = list(gca().xaxis.get_ticklabels())
print('First label is :',label_list[0].get_text())
label_list = list(gca().get_xaxis().get_ticklabels())
print('First label is :',label_list[0].get_text())

Returns empty for all calls.

I found quite frustating since testing the code manually in ipython works. While running the source from the shell or with %run in ipython it doesn't. Am I missing some update command before getting the tick labels or mpl is wrongly configured somehow?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy