-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Feature request: enable making copies of trained position scales #3441
Comments
For |
Yes, this seems correct. In the past, getting ranges of auto-expanded scales, in particular of discrete scales with data extending beyond the standard expanded range, has been difficult. (These arise with ggridges, for example.) Now it seems to work fine. We may want to document the properties of I'll see what I can do with this. It should be possible to convert a library(ggplot2)
library(ggridges)
#>
#> Attaching package: 'ggridges'
#> The following object is masked from 'package:ggplot2':
#>
#> scale_discrete_manual
p <- ggplot(iris, aes(Sepal.Length, Species)) +
geom_density_ridges()
p
#> Picking joint bandwidth of 0.181 pb <- ggplot_build(p)
#> Picking joint bandwidth of 0.181
scale_x <- pb$layout$panel_params[[1]]$x
scale_x$get_limits()
#> [1] 3.757376 8.442624
scale_x$dimension()
#> [1] 3.523114 8.676886
scale_y <- pb$layout$panel_params[[1]]$y
scale_y$get_limits()
#> [1] "setosa" "versicolor" "virginica"
scale_y$dimension()
#> [1] 0.40000 4.25645 Created on 2019-07-16 by the reprex package (v0.3.0) |
Yes, I plan to document ViewScales for #3436 before my internship is done! After #3398 is merged the ViewScales need at least one more round of tightening up. Another approach may be to add a |
I like the idea of giving |
Just a note that I played around with a |
@clauswilke Is this still something you think you'd use / would like to use? |
Not actively working on this but still think it would be good to have. Big picture I think it would be great if we had a way of making marginal plots that isn't a huge hack. Something like: make center plot; make marginal plots copying scales; stitch everything together with patchwork. |
To create plots with marginals, it would be helpful if there was a straightforward method to reliably create copies of trained position scales. I'm wondering whether this is possible or can be made possible after @paleolimbot's refactoring of the position scales.
For example, consider this code, which uses the function
cowplot::axis_canvas()
:I'd want to be able to generate the plot
p2
by writing something like the following:or maybe
The function
scale_x_copy()
would take all information (type, limits, expansion, labels) about the x position scale from the built object ofp1
and then faithfully reproduce it. Importantly, the scale should not change range or other properties based on the data provided in the second plot.I'd be happy to implement such a scale myself if somebody can give me some hints about how to best go about it.
The text was updated successfully, but these errors were encountered: