8000 [Bug]: figimage producing inconsistent results · Issue #23399 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Ski 8000 p to content
[Bug]: figimage producing inconsistent results #23399
Open
@swfiua

Description

@swfiua

Bug summary

figimage() is producing inconsistent results.

It appears a transform is sometimes applied to the image and sometimes not.

Code for reproduction

from matplotlib import pyplot
plt = pyplot
import numpy as np

fig = pyplot.figure()
ax = fig.subplots()


fig_bbox = fig.bbox
width, height = fig_bbox.width, fig_bbox.height

img = np.zeros((int(height), int(width), 3))
img += (127, 0, 0)

fig.figimage(img, 0, 0, zorder=-1)

# show the figure, image is not scaled as I would expect
plt.show()

# save as a png, image is scaled as I would expect
fig.savefig('foo.png')

# save as an svg, image matches the one in the FigureCanvas window.
fig.savefig('foo.svg')

# NB reversing the order of the two savefig calls produces images
# matching the FigureCanvas version.

Actual outcome

foo
foo

Expected outcome

I would expect all images to look like the png image, i.e. scaled to the figure size.

Additional information

No response

Operating system

Ubuntu 21.10

Matplotlib Version

3.5.0.dev2201+ge9bd017b2d.d20220707

Matplotlib Backend

'QtAgg'

Python version

Python 3.9.7

Jupyter version

No response

Installation

git checkout

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

      0