Skip to content

Bug in circle patch plotting when using the same patch for two different figures #3776

@astrofrog

Description

@astrofrog

The following code:

import numpy as np

import matplotlib.pyplot as plt
from matplotlib.patches import Circle

image = np.random.random((10,10))
c = Circle((5., 5.), 3.)

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.imshow(image, interpolation='nearest', vmin=-2., vmax=3.)
ax.add_patch(c)
fig.savefig('nearest.png')

fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.imshow(image, vmin=-2., vmax=3.)
ax.add_patch(c)
fig.savefig('default.png')

produces the following two figures:

nearest.png [looks correct]

nearest

default.png [definitely doesn't look correct]

default

This is with the latest developer version of Matplotlib with Python 3.4.

[cc @cdeil @bsipocz @larrybradley - this is the issue that is causing https://github.com/astropy/photutils/pull/114#issuecomment-48383187]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions