Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ticklabels empty when not interactive #6103

Closed
@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