Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: Flip the imshow plot types example to match the other examples #28252

Merged
merged 1 commit into from
May 17, 2024

Conversation

scottshambaugh
Copy link
Contributor

@scottshambaugh scottshambaugh commented May 17, 2024

PR summary

Flips the imshow plot types example to put the origin at the lower left instead of the default upper left. This allows for direct comparison with the 6 other examples that use the same data.

Before:
image

After:
image

PR checklist

@github-actions github-actions bot added the Documentation: plot types files in galleries/plot_types label May 17, 2024
@story645
Copy link
Member

am back and forth b/c agree that direct comparison is better suited for choosing an appropriate function but a bit unsure about this b/c ideally the plot types gallery would use as many defaults as possible/show the default behavior

@scottshambaugh scottshambaugh added this to the v3.9.1 milestone May 17, 2024
@scottshambaugh
Copy link
Contributor Author

We do put a few non-default kwargs in other examples, like an alpha value. Just added the "after" screenshot to the top level description, does the 1:1 comparison look worthwhile after seeing it?

@story645
Copy link
Member

We do put a few non-default kwargs in other examples, like an alpha value.

Yeah styling, not data reading :/ But yeah the flip option of inverting the first array so the images match is probably more confusing.

Copy link
Member

@story645 story645 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this more, on net, better for the functions to be comparable. Also honestly might be good to expose the origin keyword so it doesn't trip folks up in precisely this data arrays read are arranged differently from images way.

@story645 story645 merged commit f0f204e into matplotlib:main May 17, 2024
19 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 17, 2024
timhoffm added a commit that referenced this pull request May 17, 2024
…252-on-v3.9.x

Backport PR #28252 on branch v3.9.x (DOC: Flip the imshow plot types example to match the other examples)
@jklymak
Copy link
Member

jklymak commented May 18, 2024

I have exactly the opposite take. Folks will use imshow, their plots will be upside down, and they will wonder why that is when this page has the plots all the same. I doubt most people click through to the example to see the use of the origin keyword. I think this change will cause more confusion than not.

@scottshambaugh
Copy link
Contributor Author

scottshambaugh commented May 18, 2024

So my thought with making this change was:

  • I think that it's easy to get confused by the imshow coordinates, and showing that kwarg in more examples helps bring attention to the flag.
  • Having looked at that page maybe a dozen times, I don't think it's obvious that the plot is upside down - it just looks like blobs. I had no idea it was the same as the other examples until I was looking at the sources for another update. I think having it match the rest is a better way to key in on what the differences in the different methods are.
  • My impression is that imshow is really meant to be used with imread/PIL.Image.open rather than with generated data. If we're going to further improve the example, I'd propose we use an actual image for the example rather than a blobby raster field.

@jklymak
Copy link
Member

jklymak commented May 18, 2024

To me, the goal is to show what the same data looks like when plotted with different methods. I think that is best served using the defaults.

@story645
Copy link
Member

To me, the goal is to show what the same data looks like when plotted with different methods

That's why I came around to thinking that showing the use of the origin keyword is helpful. Like the first time I plotted data using imshow it was upside down & I was so confused - and manually flipped it using something like data[::-1] b/c I didn't know about the keyword.

@timhoffm
Copy link
Member

The plot types page is primarily to give an overview of the different kinds of visualizations, not teach any of their specifics. In that sense, it doesn't matter too much whether the data/result image is flipped or not. But generally, I'd go with using the functions mostly as is and not doing extra things to hide any specific behavior. So, I'm -0.5 on this, but don't find it important enough to go into a lengthy discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: plot types files in galleries/plot_types
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants