JuliaManifolds / Manifolds.jl

Manifolds.jl provides a library of manifolds aiming for an easy-to-use and fast implementation.
https://juliamanifolds.github.io/Manifolds.jl
MIT License
376 stars 55 forks source link

Plotting recipes #126

Open sethaxen opened 4 years ago

sethaxen commented 4 years ago

It's probably worth thinking about some of the most common plots users might want to make related to manifolds and see if we can identify a small subset of utility plotting recipes we could provide that would make it easier to do so.

What are some general plots you've found useful?

kellertuer commented 4 years ago

Very good issue to keep track of; I haven't had the tie to read into reciepes yet, but I would be very interested

  1. Plot phase valued data (Circle()) using the Hue channel of HSV producing an
  2. Plot signals/images/volumetric data of SPD as ellipsoids in every point, where the ellipsoids can be coloured for example by the anisotropy index
  3. signals/images of Sphere(2) valued data as arrows pointing out of the image plane into 3D
  4. draw spherical signals as points on the sphere
  5. Rotations by plotting a (right hand) ONB at every pixel so you can see the action of the rotation

And I would be quite interested to have such functions, for best of cases to interactive graphics for the 3D cases.

sethaxen commented 4 years ago

Very good issue to keep track of; I haven't had the tie to read into reciepes yet, but I would be very interested

There are 2 main plotting ecosystems that are maintained by the same people and are gradually unifying. They're both under JuliaPlots. One is Plots.jl and the other is AbstractPlotting.jl (which powers Makie.jl). Most plotting recipes in the wild use RecipesBase.jl, which is a lightweight package that lets one define recipes that can be just used with Plots. Soon they will also be useable with Makie. Makie is I think the way to go for interactive graphics but is still undergoing a lot of changes. It has a recipe system but it hasn't yet been split out into a lightweight package.

My thinking for this issue is to catalog some useful examples like you've listed here and then when things stabilize, implement using one or both of the recipe systems.

Another useful visualization would be for quaternions (once we have CompactSymplectic), probably using the same visualization as Rotations with some indication of spin.

sethaxen commented 4 years ago

In addition to plotting points on manifolds, we should also think about how to plot manifolds themselves via some embedding or coordinate system. Is there anything we can implement generally so that when a user implements their manifold, they already get some visualization of it and its points?

mateuszbaran commented 4 years ago

This is a hard problem. We are pretty much limited to 3 dimensions (actually 2 but there is a good way to fake the third one) and there are not that many manifolds that can be reasonably embedded in R^3. I guess we could visualize higher-dimensional manifolds by visualizing intersections of their embeddings with a 3-dimensional hyperplane that can be moved with a slider. Or visualize points on manifolds using some projections like in UMAP: https://github.com/dillondaudert/UMAP.jl .

mateuszbaran commented 4 years ago

geomstats has some interesting plotting functionality. We could perhaps take a look at that. Ref #178 .

kellertuer commented 3 years ago

Ref to #248 for two 2D recipes (Hyperbolic) and #245 which I think I know how to finish.

kellertuer commented 3 years ago

@sethaxen how would you do a visualization for rotations? I could check that after I finished those two above, now that I finally understood Plotting Recipes (RecipesBase.jl to be precise).

sethaxen commented 3 years ago

I know of two ways to visualize rotations. The first is to visualize the (passive or active) action of the rotation on some object, usually the set of x-y-z axes, but it could be any shape. This option is intuitive but can be completely unreadable when the rotations being visualized aren't very similar to each other, since they all lie every which way (geomstats does this, for example). This is also the sensible way to visualize SpecialEuclidean(3) (just use the translation to shift the origin).

The second is to map each point to the Lie algebra with the group exponential and visualize that, which is a ball of radius π. The direction is the axis of rotation, and the distance from the origin is the angle of the rotation. This option is less intuitive and has some weird effects where opposite points correspond to the same rotation (this can be handled by standardizing to a half-ball around some central rotation), but it is less cluttered. This latter representation can also be used for ProjectiveSpace(3), and a similar one can be used for visualizing the unit quaternions and Sphere(3).

I really think we should have both of these.

sethaxen commented 3 years ago

And that's SO(3), of course. Points on SO(2) can of course be visualized as a point on a circle or in a point in any interval on the real line of length 2pi, which corresponds to the Lie algebra representation. But if one wants to visualize SE(2), then you'll also want the visualization of SO(2) via its action on a body.

kellertuer commented 3 years ago

Sure we should have all of those :)

For SO(3) there is also a huge zoo of possibilities, when you further consider their quotient spaces. A colleague of mine is working on MTEX / orientation plot, for example https://mtex-toolbox.github.io/EBSDOrientationPlots.html - but there are many more. This might be too much for now but Rotations would be nice, for sure.

I mainly wanted to collect a list of nice plots – maybe (together with the currently developed Poincare ball and Poincare halfplane, Sphere and I have an idea for Hyperbolic as well) as a list in the first post?

My further ideas are some, that I currently already do with Asymptote exports in Manopt.jl (though they are transcribed Matlab interfaces and not yet nice to use, also something I would like to change)

3D stuff still seems to be a little tricky in Julia plots – Make does some job there, but does not work well with RecipesBase, Plots – depends on the backend and in the cases I saw until now not with transparency.

So if we could do that as a list, I can from time to time solve them, for sure. If you have references on more details, feel free to add also links to get started – also examples often help