Skip to content

get_ticklabels returns '' in ipython/python interpreter #6638

Closed
@story645

Description

@story645

ax.get_xticklabels & ax.get_yticklabels is returning a list of empty strings when I run the code via script/ipython interpreter, but works as expected (returns list of ticklabels) when called in ipython notebook. This makes me think it's a backend bug, but I'm mystified.

Env:

Python 3.5.1 |Continuum Analytics, Inc.| (default, Dec  7 2015, 11:24:55) 
[GCC 4.2.1 (Apple Inc. build 5577)] on darwin

matplotlib version:

  • 1.5.1 (installed in different anaconda env to verify not a beta bug)
  • 2.0.0b1.post1730.dev0+gfdce976 (last pulled in a few hours ago)

This will reproduce it: (I use agg here, but MacOSX is exhibiting the same behavior)

import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.plot([1,2,3])
print(list(l.get_text() for l in ax.get_xticklabels()))
print(list(l.get_text() for l in ax.get_yticklabels()))

Both print statements yield ['', '', '', '', ''] when they should be [0, 1, 2] & [1, 2, 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions