Skip to content

Tweak streamplot plot_types example. #21124

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

Merged
merged 1 commit into from
Sep 19, 2021
Merged

Tweak streamplot plot_types example. #21124

merged 1 commit into from
Sep 19, 2021

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Sep 19, 2021

  • zorders don't need to be explicitly set, the contour is already below
    the streamplot.
  • alpha=0.5 for the contour seems too faint IMO; fully opaque seems
    better?

before:
old
after:
new

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

This is the only example that uses a secondary color. What is the purpose of the contour here anyway? I think we can just remove it.

While at it, you could add ax.grid(False) after the subplots commands. I think we should leave out the grid for all surface like plots (i.e. where x and y are the dependend variables).

@anntzer
Copy link
Contributor Author

anntzer commented Sep 19, 2021

Removed the grid. I think showing some contours is nice (to hint that the streamlines are indeed following the contour lines), but I can remove them if you feel strongly about it.

@timhoffm
Copy link
Member

I think showing some contours is nice (to hint that the streamlines are indeed following the contour lines)

The following is not exact (probably because they are not using the same values), see marked regions:
grafik
so not sure what that would tell us.

On a more general note: I don't think it's important for showcasing the plot type of stream lines that it is related to contours. IMHO all the example plot should have to tell is "We can plot stream lines. This is how they look". So I'm still in favor of removing the contour.

- remove contour plot for simplicity.
- don't set zorder.
- Z doesn't need to be made positive.
@anntzer
Copy link
Contributor Author

anntzer commented Sep 19, 2021

removed the contour, then.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

Anybody can merge after CI pass.

@jklymak
Copy link
Member

jklymak commented Sep 20, 2021

The point of plotting the streamplot over the underlying stream function is that a) it is the same data as the other contour plots, and b) that the two ways of looking at the data are intimately related. Of course the two aren't the same at finite resolution, but as dx/dy->0 they converge.

@anntzer
Copy link
Contributor Author

anntzer commented Sep 20, 2021

I would support putting it back, but I don't feel overly strongly about it either.

@timhoffm
Copy link
Member

The point of plotting the streamplot over the underlying stream function is that a) it is the same data as the other contour plots, and b) that the two ways of looking at the data are intimately related.

The primary goal is an example visual representation of the plot type.

a) The data is not particularly important. Data should primarily be chosen to give a good repesentation of the plot type. This may or may not be the same data as for other plots.
b) Relations between plot types is beyond the scope here. This is additional information better suited either in the docstring or a dedicated example. Anyway, IMHO this also needs textual description. Only plotting the two on top of each other without further comment does not get the message across.

@jklymak
Copy link
Member

jklymak commented Sep 21, 2021

In general, when trying to teach something, the more you can reuse the same example in different ways, the better. Of course you should not sacrifice clarity to do so, but when possible it really helps get concepts across for readers to not have to change contexts a lot.

tacaswell pushed a commit to tacaswell/matplotlib that referenced this pull request Oct 12, 2021
Tweak streamplot plot_types example.
tacaswell pushed a commit that referenced this pull request Oct 20, 2021
Tweak streamplot plot_types example.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants