Skip to content

Conversation

@larsoner
Copy link
Member

@larsoner larsoner commented Sep 1, 2020

Closes #8192

In this PR on mayavi:

Screenshot from 2020-09-01 16-28-42

pyvista:

Screenshot from 2020-09-01 16-29-02

these look different but I think it might just be a subtle angle/perspective difference (?), here's a different angle:

Screenshot from 2020-09-01 16-29-55
Screenshot from 2020-09-01 16-30-29

@GuillaumeFavelier can you look and see if the difference is meaningful and if necessary push commits to fix it? Also might be a good idea to check the code for any other instances of if/elif/elif and change them to if/elif/else with an assert like I did here (preferably with a user-friendly _check_option so that the assert is just an internal sanity check).

@larsoner larsoner added this to the 0.21 milestone Sep 1, 2020
@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Sep 2, 2020

Many thanks for refactoring quiver3d(), it greatly helps!

There is indeed a difference on how the glyph is centered.

lower opacity on the glyph, center with a red sphere:

Mayavi Pyvista
image image

Of course we want the backends to be consistent. By default, I will assume that Mayavi is the desired result and modify _pyvista.py accordingly.

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Sep 2, 2020

By default, I will assume that Mayavi is the desired result

Using the sphere mode, I have second thoughts though...

Mayavi PyVista
image image

@GuillaumeFavelier
Copy link
Contributor

Ideally, I think we want the glyphs to behave like Mayavi in cone mode but like PyVista if the sphere mode is selected right? @agramfort , @larsoner

@hoechenberger
Copy link
Member

hoechenberger commented Sep 2, 2020

Ideally, I think we want the glyphs to behave like Mayavi in cone mode but like PyVista if the sphere mode is selected right? @agramfort , @larsoner

I would very much say: yes

This is the behavior we want:

91959129-85e32a80-ed08-11ea-9727-79644936d5ea
91960338-153d0d80-ed0a-11ea-9cfa-aeee31f369b1

@hoechenberger
Copy link
Member

hoechenberger commented Sep 2, 2020

No wait. The center of the sphere should be at the exact location where the "red dot / origin" of the cone is. I cannot see in the pics whether for pyvista, the center of the sphere is shifted "to the outside" of the brain, away from the surface. This is not what we want: the center of the sphere should rest on the surface.

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Sep 2, 2020

For PyVista, the center of the spheres and the red dots are at the same position. Does it answer your question? I can push a test commit and you can verify.

@hoechenberger
Copy link
Member

For PyVista, the center of the spheres and the red dots are at the position. Does it answer your question? I can push a test commit and you can verify.

Great, that answers my question.

@GuillaumeFavelier
Copy link
Contributor

GuillaumeFavelier commented Sep 2, 2020

I pushed d2fc5fb for testing purpose only. You can take a look @hoechenberger, @larsoner. It should be reverted before merge.

x Mayavi PyVista
cone image image
sphere image image

@GuillaumeFavelier
Copy link
Contributor

I pushed 8d51365 to make the cone radius consistent too:

Mayavi PyVista
image image

@larsoner
Copy link
Member Author

larsoner commented Sep 2, 2020

That looks right to me. For quiver matplotlib has the "pivot" argument, but we should just document that it's always the tail for arrows and cones and center for sphere (and make sure that this is the case). Not sure which cylinder should be, probably tail.

@hoechenberger
Copy link
Member

Not sure which cylinder should be, probably tail.

I would say tail, too, to be consistent with cones.

@GuillaumeFavelier
Copy link
Contributor

For plot_sparse_source_estimates() no cylinder mode is available but in general, when quiver3d() is used with cylinder, there is a glyph_center parameter to change the 'pivot'.

@larsoner
Copy link
Member Author

larsoner commented Sep 2, 2020

Ahh okay, so no changes needed then I think!

@agramfort
Copy link
Member

@larsoner and @GuillaumeFavelier merge if you're happy

thx

@larsoner larsoner merged commit 62fabdb into mne-tools:master Sep 2, 2020
@larsoner larsoner deleted the sphere branch September 2, 2020 14:37
hoechenberger added a commit to hoechenberger/mne-python that referenced this pull request Sep 3, 2020
mne-tools#8194 introduced changes to `mne.viz.backends._utils.VALID_3D_BACKENDS`.

Now, if `viz.backends.renderer._get_3d_backend()`
cannot find a valid backend, the string formatting
doesn't work (`VALID_3D_BACKENDS` is a tuple, and we're trying to format
the string with only a single `%s`.

This commit not only fixes that, but improves formatting ever so
slightly.
agramfort pushed a commit that referenced this pull request Sep 3, 2020
#8194 introduced changes to `mne.viz.backends._utils.VALID_3D_BACKENDS`.

Now, if `viz.backends.renderer._get_3d_backend()`
cannot find a valid backend, the string formatting
doesn't work (`VALID_3D_BACKENDS` is a tuple, and we're trying to format
the string with only a single `%s`.

This commit not only fixes that, but improves formatting ever so
slightly.
marsipu pushed a commit to marsipu/mne-python that referenced this pull request Oct 14, 2020
* FIX: Fix bug with sphere plotting

* Complete branching

* Make glyphs consistent between 3d backends

* TST: Test translucent glyphs with red dot centers

* Decrease cone glyph radius

* Revert "TST: Test translucent glyphs with red dot centers"

This reverts commit d2fc5fb.

* Clarify docstring

* Update latest.inc

Co-authored-by: Guillaume Favelier <guillaume.favelier@gmail.com>
marsipu pushed a commit to marsipu/mne-python that referenced this pull request Oct 14, 2020
mne-tools#8194 introduced changes to `mne.viz.backends._utils.VALID_3D_BACKENDS`.

Now, if `viz.backends.renderer._get_3d_backend()`
cannot find a valid backend, the string formatting
doesn't work (`VALID_3D_BACKENDS` is a tuple, and we're trying to format
the string with only a single `%s`.

This commit not only fixes that, but improves formatting ever so
slightly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: Arrows gone in mixed norm plotting

4 participants