Skip to content

Panel of "Beautiful Sunny" plotting tutorials #443

@kbarros

Description

@kbarros

Inspired by Beautiful Makie, let's create panel of "Beautiful Sunny" plotting tutorials to be included in the contributed docs pages.

Instructions here:
https://github.com/SunnySuite/SunnyContributed/tree/main/contributed-docs/gallery/src

Some ideas discussed on Slack:

@ddahlbom:

I think a lot of the challenges have to do with becoming familiar with Makie's grid layout features and then knowing how to extract useful information from Sunny data structures. For example, even if one uses heatmap instead of using plot_intensities for more fine-grained control,
it's very useful to have access to the xticks generated by Sunny.

The example below is very simple, but it involves a number of things one would like to do without having to go through too much documentation: (1) group sets of plots together visibly, (2) have color bars associated with blocks of plots rather than each heatmap, (3) achieve font uniformity throughout all features of the plot. This was something I worked on with @fwilli18. I'll see if I can get the script from him and make a MWE. (Thanks also to @Hao-Phys for sharing the latex font style trick.)

Image

Or similarly something like the figure below on the left. I always have to go through a lot of documentation to get these things completed entirely within Makie/Sunny.

Additionally, it would be good to show how to work with the internals of plot_spins in a more fine-grained way, in particular setting camera angles programmatically, eliminating bounding boxes, etc. This is often useful for showing real space spin configurations. I think many people take outputs from Sunny and put them into another drawing program to build up compound figures, but there is always a huge advantage to having everything done within Julia when it comes time to make revisions.

Image Image

@hlane33

How about an interactive 3d S(q,w) visualizer. It is easy to set up with Makie.

Image

I'd like to second @ddahlbom's point about plotting spin configurations. I recently hacked together something to output a multipanel figure, using plot_spins!() to plot into a subfigure. The result is not optimal, but I'm certain it can be made slicker.

Image

@kbarros

There is already planned work for 3D data visualization in q-space with respect to the 1st BZ. This is possible today:

using Sunny, GLMakie
latvecs = lattice_vectors(1, 1, 1, 90, 90, 90)
positions = [[0,0,0]]
cryst = Crystal(latvecs, positions, 227, choice="1")
path = q_space_path(cryst, [[0,0,0], [1,0,0]], 50)
grid = q_space_grid(cryst, [1, 0, 0], range(-1, 1, 50), [0, 1, 0], (-1, 1))
view_bz(cryst, path, grid)
Image

@hlane33

Overplotting the 1BZ on 2d constant energy slices is commonplace in neutron papers. It seems that the ingredients exist in the symmetry module to turn this into a one-liner? [Answer is yes, with Scene returned by view_bz(cryst, objs...))]

@ddahlbom

For the sake of starting a discussion, I pushed an example that works with saved ground states from @fwilli18 study. The simulation takes ~10-15s (but uses saved ground states), and the plotting a couple of seconds. The main idea here was just to show what goes into making a publication figure and how Sunny's plotting tools can be adapted to the process.

Image

Proposed workflow

Produce a markdown file (which may embed arbitrary static HTML), along with images. This is packaged up into a compressed .tar.gz file. From the main Sunny docs, we already have a mechanism in place to collect the pre-built .tar.gz and include it in the docs deployment (https://github.com/SunnySuite/Sunny.jl/blob/main/docs/make.jl#L84-L106). This is how we currently include the three contributed tutorials to the Sunny docs and avoid long run-times in the CI/CD deployment: (https://sunnysuite.github.io/Sunny.jl/stable/examples/contributed/MgCr2O4-tutorial.html).

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions