aspect="auto" for px.imshow does nothing when plotting RGB data
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 18.8k
- Forks
- 2.8k
- Avg merge
- 16h 26m
- Merged PRs (30d)
- 21
Description
I am trying to plot an RGB image that strecthes to fill the figure, and I cannot get it to work.
Using a standard 2D array works as expected, and the image is able to dynamically stretch to the figure.
arr = np.random.random((100, 100))
px.imshow(arr, aspect="auto")
But if I instead try to plot an RGB image with the same settings, then the image stays with its original aspect ratio.
img = np.random.random((100, 100, 3))
px.imshow(img, aspect="auto")
In this case, setting the aspect key does nothing and the image keeps a fixed aspect ratio. Explicitly adding with and height also does nothing to change the aspect ratio.
Is this an expected limitation of the aspect setting? If yes, then it should probably be documented.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the px.imshow examples in the issue and compare the 2D-array and RGB-array paths, focusing on how aspect="auto" is handled. Done means RGB images stretch as expected, or the limitation and its effect on width and height are documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100