create set_offsets3d for PathCollection3d by ianhi · Pull Request #19573 · matplotlib/matplotlib · GitHub
Skip to content

create set_offsets3d for PathCollection3d - #19573

Draft
ianhi wants to merge 1 commit into
matplotlib:mainfrom
ianhi:offsets3d
Draft

ianhi wants to merge 1 commit into
matplotlib:mainfrom
ianhi:offsets3d

Conversation

@ianhi

@ianhi ianhi commented Feb 24, 2021

Copy link
Copy Markdown
Contributor

PR Summary

Add set and get_offsets3d to the PatchCollection3d object. The casting back to numpy array and transpose in the get method is for consistency with what the 2d version that returns a numpy array with shape (N, 2).

Does this need an example or can that be left to #19520?

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).

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry to be so critical, but 3D is a mess and without a clear picture where we want to go we risk making it only worse.

We need a bit more thinking to get a consistent 3D API. We currently have,

  • Text3D.set_positions_3d, having optional zdir
  • Lines3D.set_data_3d , not having zdir`

Do we want a zdir parameter for data setters?

Also the 3D upcasting is solved differently. Text3D takes zdir but defers the data adaption to draw. In contrast Line3D doesn't even accept zdir in __init__ instead, Axes3D.plot calls line2d_to_3d() which passes zdir to set_3d_properties() and immediately modifies the data. Thus Text3D.get_positions_3d and Line3D.get_data_3d have different interpretations of the returned data, wrt. if zdir is applied.

When and how do we want to apply zdir? What interpretation should the getter return?

@ianhi

ianhi commented Feb 28, 2021

Copy link
Copy Markdown
Contributor Author

@QuLogic

QuLogic commented Mar 2, 2021

Copy link
Copy Markdown
Member

Text3D takes zdir but defers the data adaption to draw.

This is something I implemented in #18525 when adding the getters/setters on purpose, and I would do the same for the other 3D artists (#18932) except that it requires some work to fix legends.

I can't say exactly what the API should be, but we should try to defer as much as possible the conversion to 2D to draw. Eventually, if we have a better 3D renderer, then it will be able to ingest the 3D values directly there instead.

@timhoffm timhoffm added the status: needs comment/discussion needs consensus on next step label Mar 6, 2021
@jklymak
jklymak marked this pull request as draft May 15, 2021 15:26
@github-actions

Copy link
Copy Markdown

@github-actions github-actions Bot added the status: inactive Marked by the “Stale” Github Action label Nov 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: inactive Marked by the “Stale” Github Action status: needs comment/discussion needs consensus on next step status: needs rebase topic: mplot3d

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants