plot icon indicating copy to clipboard operation
plot copied to clipboard

Plot.image render SVG elements

Open mkfreeman opened this issue 2 years ago • 7 comments

I've found that rendering <svg> elements - specifically those made using plot - can be a powerful visualization technique (example). This is a first pass at supporting svg rendering through the Plot.image mark.

Unsure if this is a desired feature or approach, but figured I could start the conversation.

mkfreeman avatar Sep 14 '23 19:09 mkfreeman

Thanks for your thoughts! I definitely imagine this as a data-driven mark, as in the notebook (sorry the test wasn't more representative of the use-case).

Great point that this may nudge users into a bit of an anti-pattern where they're rendering plots with different scales and showing them together.

In some cases, users may not be concerned with a shared scale across plots (for example, drawing country outlines): Screenshot 2023-09-14 at 3 38 48 PM

I'll think a little more about how (if) a mark like Plot.svg could behave (or be described) in a more generalizable way. Will also look at the rendering.

mkfreeman avatar Sep 14 '23 19:09 mkfreeman

I like the idea of subplots or “subfacets” that share scales but can be positioned arbitrarily in x and y.

mbostock avatar Sep 14 '23 19:09 mbostock

Interesting - definitely a bit of a larger undertaking 😭 , will think about it!

mkfreeman avatar Sep 14 '23 20:09 mkfreeman

A bit like https://observablehq.com/@observablehq/plot-of-plots?

Fil avatar Sep 15 '23 07:09 Fil

Yes, but with shared scales. I think it would be a similar mechanism to how facets currently work, with the difference being that you can position the facet arbitrarily in the main plot’s x and y coordinate space, and then the subplots have their own x and y scales (shared across subplots).

mbostock avatar Sep 15 '23 10:09 mbostock

There's also overlap with the desire for custom tips (#1767) - if subplots can be arbitrarily positioned in x/y space, then with a Pointer transform, they could allow for custom tip content.

Enabling the Tip mark to render svg elements (most importantly, Plots) would get most of the functionality here (except for shared scales).

mkfreeman avatar Sep 15 '23 15:09 mkfreeman

See #1870

Fil avatar Sep 26 '23 09:09 Fil