New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rugs (and marginal histograms?) #791
Comments
The trouble with ticks is that there is a lot of occlusion, and no good way to fight it (opacity breaks if there are many ticks; and jittering is only the cheapest way to create a sense of local density). Here are three alternatives with bins represented as symbols or rects: https://observablehq.com/@fil/plot-rugs When Plot.dodgeX lands it will be better. We could also imagine a layout that returns the violin shape of a 1-d distribution. Another alternative that would be useful is if we could pass a pixel-height to a 1-dimensional rect mark, which reconnects to your suggestion of a length option on rules: when a 1-d mark is inserted in a 2-d context, frameAnchor tells us where it goes, but not what its size on the opposite axis is. |
Sure, but it’s easy to do, and there’s precedent, and it’s sometimes useful. I would also like us to have a good way to produce marginal histograms, e.g. https://www.tableau.com/about/blog/2015/11/how-make-scatterplot-marginal-histograms-45811 You showed how to do that with the group transform here, and counts: https://talk.observablehq.com/t/github-like-activity-diagram-with-some-modifications/6285/3 But I’m not sure we have a good way of doing that with bars of varying length (or rects), since in effect this requires multiple x or y scales (one of the main plot and one for the margins). You can also do it by constructing multiple plots and then laying them out with CSS, but that’s probably more work than we want. |
Yes, my point was to say that we should generalize the concept of "controlling the opposite dimension of a 1-dimensional mark, even when it's in a 2-d context". Currently for such a mark [and supposing its main dimension is X], the y dimension will span all of [marginBottom + insetBottom, height - marginTop - insetTop], where what we'd want is something based on frameAnchor & a given height. This might also be useful for layouts (?) |
(Rehashing of the same idea as my comment above.)
|
Let me recommend wedge shapes e.g. https://observablehq.com/@jrus/d3-density-contours https://observablehq.com/@jrus/pj If you want a better idea of the distribution in denser areas you can even layer wedges at different densities (e.g. the top layer can be deciles, the next layer %iles, then ‰iles, ...). E.g. see https://observablehq.com/@jrus/ford-circles |
This works really well now, and wedges are 👍 I don't think we need an additional specific mark, with vectors and frameAnchor. Closing as completed. |
We could have a convenience constructor for rules (by assigning insets, or perhaps by exposing a length option on rules) that lets them be used to create rug plots, similar to geom_rug in ggplot2.
The text was updated successfully, but these errors were encountered: