Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add 3D plots to plot_types doc page#24108

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
story645 merged 1 commit intomatplotlib:mainfromj1642:add-3d-plots-to-gallery
Oct 23, 2022

Conversation

j1642
Copy link
Contributor

PR Summary

Add assorted 3D plot examples from the general gallery (https://matplotlib.org/devdocs/gallery/mplot3d/index.html) to the plot_types gallery (https://matplotlib.org/devdocs/plot_types/index.html) to increase visibility of Matplotlib's 3D capabilities.

Issue link:#23900

PR Checklist

Tests and Styling

  • Has pytest style unit tests (andpytest passes).
  • IsFlake 8 compliant (installflake8-docstrings and runflake8 --docstring-convention=all).

Documentation

  • New features are documented, with examples if plot related.
  • New features have an entry indoc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented indoc/api/next_api_changes/ (follow instructions in README.rst there).
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).

Copy link

@github-actionsgithub-actionsbot left a comment

Choose a reason for hiding this comment

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

Thank you for opening your first PR into Matplotlib!

If you have not heard from us in a while, please feel free to ping@matplotlib/developers or anyone who has commented on the PR. Most of our reviewers are volunteers and sometimes things fall through the cracks.

You can also join uson gitter for real-time discussion.

For details on testing, writing docs, and our review process, please seethe developer guide

We strive to be a welcoming and open project. Please follow ourCode of Conduct.

@story645
Copy link
Member

story645 commentedOct 6, 2022
edited
Loading

Thanks for the PR! I unfortunately don't have concrete suggestions but I'm wondering if some of these examples can be smaller/more straightforward? The goal of this gallery isn't necessarily pretty pictures, just examples that clearly show what data goes into what plots & what plots are available.

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch 2 times, most recently from034904d to53ea816CompareOctober 7, 2022 15:32
@j1642
Copy link
ContributorAuthor

Thanks for the feedback. I have curated a more straightforward set of examples in matplotlib/plot_types/3D.

Sorry about all of the commits, this is my first pull request and I'm still getting used to Git. If I need to rebase or do anything else, please let me know. I will wait for feedback before making any new commits or merges.

@story645
Copy link
Member

story645 commentedOct 7, 2022
edited
Loading

It looks like your code got muddled in w/ the rebase.

Git is a pain. I'm gonna suggestcherry picking b/c it's what I just did to clean a branch, but there may be an easier way to clean your branch. Also feel free to drop by our incubator channel w/ questions!

  1. locally checkout main
    git checkout main
  2. rebase main to upstream main
    (on main)git rebase upstream/main
  3. checkout new branch FIX (while main is checked out, so FIX is branched off a synced main)
    (on main)git checkout -B FIX
  4. on new branch FIX, cherry pick just the commits that are relevant to this PR
    (on FIX)git cherry-pick 910ed53147058d02f43bd02865e7420be08e4969 53ea816a5e3e0a3002026c059f69aaf53c284e4b
  5. delete your local 'add-3d-plots-to-gallery'
    (on FIX)git branch --delete add-3d-plots-to-gallery
  6. rename FIX to 'add-3d-plots-to-gallery'
    (on FIX)git branch -m add-3d-plots-to-gallery
  7. checkgit log to check that the only commits on this branch are the ones relevant to this pr. Here's a simplified variant/the numbers may be different for you)
commit 910ed53147058d02f43bd02865e7420be08e4969 (HEAD ->'add-3d-plots-to-gallery, origin/'add-3d-plots-to-gallery)3d example codecommit cada8fb565b1e1cfeb076f1f6ab791b1640d387d (upstream/main, main)Merge: 363713442b da3790fc4e
  1. push back to this branch

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from3f66b2d to52a1f12CompareOctober 7, 2022 18:12
@timhoffm
Copy link
Member

These examples need to become more in line with the rest of plot types (take the others as example):

  • Adapt the styling
  • Make the text minimal
story645 reacted with thumbs up emoji

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from52a1f12 to5dfc6b1CompareOctober 7, 2022 23:05
Copy link
Member

@story645story645 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 loads better! I'm a little concerned that the voxels example is still trying to do a drop too much.

The big things this needs is consistent figure creation and please follow the plot gallery style, which is that the examples have a title and then the next line is a link to the function being illustrated in that example
https://github.com/matplotlib/matplotlib/blob/main/plot_types/basic/scatter_plot.py

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from5dfc6b1 to3296bd3CompareOctober 13, 2022 00:58
@story645
Copy link
Member

Almost there! The gallery examples follow a# make data, # plot format which you've done in trisurf, voxels; please amend scatter, surface, and wireframe to match.

Also, the failed doc tests means I can't see how the new style is being applied to the gallery entries. I think sphinx is mad b/c you're using the same names as the gallery example:

WARNING: Duplicate example file name(s) found. Having duplicate file names will break some links. List of files: ['../plot_types/3D/scatter3d.py', '../plot_types/3D/surface3d.py', '../plot_types/3D/trisurf3d.py', '../plot_types/3D/voxels.py', '../plot_types/3D/wire3d.py']

so please change the names - appending simple should be fine.

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from3296bd3 to3eeb45eCompareOctober 13, 2022 14:35
@j1642
Copy link
ContributorAuthor

j1642 commentedOct 13, 2022
edited
Loading

Thanks again for feedback, everyone.

Where was that warning message about duplicated file names? I didn't see it under "Details" for "View the built docs" or "ci/circleci: docs-python38", but my browser was having issues showing the previous circleci.com page.

Edit: I see the warnings on circleci now.

@jklymak
Copy link
Member

This is looking good. You have a build failure however.

  1. Please remove the tick labels
  2. In the description, make it clear that these are from a toolkit. Something like "3D plots using 3D mpltoolkit". They are a bit confusing because they are not in the main library.

Thanks!

@j1642
Copy link
ContributorAuthor

One way to remove the tick labels is by addingax.set_xticklabels([]),ax.set_yticklabels([]), andax.set_zticklabels([]).

Is this acceptable? Or is there a cleaner, preferred way to remove all tick labels? Maybe through styling?

@story645
Copy link
Member

the examples all useax.set to set stuff like ticks and you may need to edit the styles athttps://github.com/matplotlib/matplotlib/tree/main/lib/matplotlib/mpl-data/stylelib to add in 3D configs

Copy link
Member

@story645story645 left a comment

Choose a reason for hiding this comment

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

Yay, thanks for putting up w/ all the tweaks!

I think it's good enough to merge, but if you have bandwidth, I'd be interested in seeing some shades of blue color variation on the surfaces/wireframes and the voxels colored two colors.

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from5dfda69 to458f6abCompareOctober 19, 2022 21:09
@j1642
Copy link
ContributorAuthor

For the surfaces, I agree that a color gradient could increase visual clarity. I think these changes work well while adding minimal complexity.

Regarding the voxels, the color-related code was removed from theoriginal gallery example. Is reintroducing distinct colors worth increasing the Plot Types code complexity?

For the wireframe, after reading through the docs and doing some testing, it is unclear if a z-coordinate-dependent color gradient can be added to each plotted line. And the cmap keyword, e.g.cmap=cm.viridis, does not change the wireframe appearance.

@story645
Copy link
Member

Yup you're right, wireframe doesn't support colormapping. Sorry about that! And I don't have strong opinions on voxels, so will agree w/ you to keep it on the simple less pretty side.

@story645
Copy link
Member

Oh this is so pretty and I'm just giving@jklymak and@timhoffm a day or two to comment before I merge.

Screenshot_20221019-225221.jpg

3D
--

3D plots using the mpl_toolkits library.
Copy link
Member

Choose a reason for hiding this comment

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

Tiny nit but can you crosslink this to thehttps://matplotlib.org/devdocs/api/toolkits/mplot3d.html API docs?

@j1642j1642force-pushed theadd-3d-plots-to-gallery branch from458f6ab to7985c21CompareOctober 20, 2022 14:16
@story645
Copy link
Member

Congrats 🥳 on your first PR into matplotlib, thank you so much for your patience with our feedback 😅, and we hope to see you again!

@story645story645 linked an issueOct 23, 2022 that may beclosed by this pull request
5 tasks
oscargus added a commit that referenced this pull requestOct 23, 2022
…108-on-v3.6.xBackport PR#24108 on branch v3.6.x (Add 3D plots to plot_types doc page)
@j1642j1642 deleted the add-3d-plots-to-gallery branchNovember 14, 2022 18:51
@ksundenksunden mentioned this pull requestFeb 20, 2023
6 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@story645story645story645 approved these changes

@github-actionsgithub-actions[bot]github-actions[bot] left review comments

@timhoffmtimhoffmtimhoffm approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.6.2
Development

Successfully merging this pull request may close these issues.

[Doc]: Adding some 3D plots to plot gallery
5 participants
@j1642@story645@timhoffm@jklymak@scottshambaugh

[8]ページ先頭

©2009-2025 Movatter.jp