Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: Add an example for 2D images in 3D plots #28280

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
May 23, 2024

Conversation

timhoffm
Copy link
Member

Serving

  • Separate planes (well, one would be enough then) is a simpler example that should be done separately.

Originally posted by @story645 in #28239 (comment)

A fundamental limitation of the 3D plotting engine is that intersecting objects cannot
be drawn correctly. One object will always be drawn after the other. Therefore,
multiple image planes can well be used in the background as shown in this example.
But this approach is not suitable if the planes intersect.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is a good paragraph to include, this "2.5D" renderer behavior is non-obvious, and we should mention it as often as possible IMO.

Copy link
Member

@story645 story645 May 23, 2024

Choose a reason for hiding this comment

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

Yeah, I also think this is great - it explains why this needs to be a separate example and so will be nice to link to off the intersecting example (and they can all have the same tag https://matplotlib.org/devdocs/devel/tag_guidelines.html )

imshow3d(ax, data_yz, value_direction='x', cmap='magma')
imshow3d(ax, data_zx, value_direction='y', pos=ny, cmap='plasma')

plt.show()
Copy link
Contributor

Choose a reason for hiding this comment

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

Image from the built docs:

image

It may be more impactful if you manually set the axlims so the images line up with the backing planes, but your call. Can self merge if you prefer as-is.

Copy link
Member Author

Choose a reason for hiding this comment

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

I slightly favor leaving it as is:

  • Less optional configuration code keeps the example more readable
  • I like that the planes are floating above the axes cube. This is a slight visual hint that the images are not tied to the cube and can theoretically be anywhere.

@timhoffm timhoffm added this to the v3.9.1 milestone May 23, 2024
@timhoffm timhoffm merged commit d901275 into matplotlib:main May 23, 2024
20 checks passed
@timhoffm timhoffm deleted the doc-imshow3d branch May 23, 2024 08:33
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request May 23, 2024
rcomer added a commit that referenced this pull request May 23, 2024
…280-on-v3.9.x

Backport PR #28280 on branch v3.9.x (DOC: Add an example for 2D images in 3D plots)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: examples files in galleries/examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants