Skip to content

Document idiosyncratic behavior of transform kwarg #12551

Open
@munkm

Description

@munkm

Bug report

Bug summary

Passing transform=None through imshow results in a blank plot.

I've been playing around a little bit with data transforms and projections in matplotlib. For one of the things I've been testing out, I also want to see how my data looks if the transform isn't set by the user, so I passed in transform=None as a kwarg to imshow. This resulted in a blank plot. I'm not sure if this is a preferred outcome, but I personally would have expected a plot without a transform set, but the data showing.

Code for reproduction

from numpy import random
import matplotlib.pyplot as plt

data = random.random((20,20))

fig, (ax1, ax2)  = plt.subplots(2)

ax1.imshow(data)
ax2.imshow(data, transform=None)
plt.show()

Outcome
image

Matplotlib version

  • Operating system: OSX Sierra 10.12.6
  • Matplotlib version: 2.2.2 and 3.0.0
  • Matplotlib backend (print(matplotlib.get_backend())): MacOSX
  • Python version: 3.6.5 and 3.6.6

I tried testing this script out in two different conda environments that I have on my machine with the same result. Both envs I tested this script out on use matplotlib pulled from conda-forge. One environment has v2.2.2 and the other has v3.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationkeepItems to be ignored by the “Stale” Github Action

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions