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

Skip to content

Bug when clearing axes created with twinx #4160

Closed
@astrofrog

Description

@astrofrog

Buggy case

The following example produces an empty figure:

import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
ax2 = ax1.twinx()
ax2.cla()
ax1.plot([1,2,3])
fig.savefig('test.png')

test

Control case

If I remove twinx it works:

import matplotlib.pyplot as plt

fig = plt.figure()
ax1 = fig.add_subplot(1,1,1)
ax2 = ax1.twinx()
ax1.plot([1,2,3])
fig.savefig('test.png')

test

Versions

$ python --version
Python 3.4.2 :: Continuum Analytics, Inc.
$ python -c 'import matplotlib; print(matplotlib.__version__)'
1.4.2

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