biocore / emperor

Emperor a tool for the analysis and visualization of large microbial ecology datasets
http://biocore.github.io/emperor/
Other
52 stars 50 forks source link

Add "figure mode" button [WIP] #767

Open fedarko opened 4 years ago

fedarko commented 4 years ago

Closes #753 and closes #604.

This PR adds a small lightbulb icon in the top-right corner of the display, directly to the left of the "More Options" button:

image

On clicking this button, the plot changes to use more easily-displayable-in-a-paper settings:

image

The exact things that this button does are:

  1. Make the plot 2D
  2. Change the axis color to black
  3. Change the background color to white
  4. Change all of the shapes to circles (#604)

The first three of these things required minimal extra code (as is shown in controller.js, each takes up one line of code -- I attribute this to Emperor's APIs being really well designed :).

The fourth thing (making everything a circle), however, required more work -- and this is what I'm most uncertain about here.

This PR adds "Circle" as a selectable shape, and it seems to work pretty well in the JS interface -- but there are some artifacts in the exported screenshots, for example with the Jaccard moving pictures PCoA:

In-Emperor image

Exported PNG (note the "triangle" borders within each circle, as well as the slight inconsistency of that one blue dot at the top being partially on top of orange) emperor (2)

Exported PNG (zoomed in at the top) image

Anyway, I was thinking we may we want to be smarter about shapes for the 2D mode anyway -- and do something similar to how DecompositionView._buildVegaSpec() has an object set up to convert 3D shapes to "close" 2D shapes. That might require extra work due to a need to add more 2D shapes to Emperor, so before doing that I wanted to check to see what folks would prefer (we could also conceivably not change the shapes at all, and/or leave doing that to a separate PR). So this is marked as a draft for now.

(Also, this PR should have tests, at least for things like makeEverythingACircle().)