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] different scales by facet #1613
Comments
Doing it that way would most likely complicate the design, since it complicates the process by which each # create scales with different parameters e.g. labels,
sc1 <- scale_y_continuous(...)
sc2 <- scale_y_continuous(...)
sc3 <- scale_y_continuous(...)
facet_grid(Magnitude~., scales_y=c(sc1, sc2, sc3) ) Position scales can be shared between facets and that is what If you would like to try implementing it, |
Thanks for your feedback and advice, @has2k1. Progress on your suggestions (and issues I see)I have tried to work a bit on your approach, I have achieved a point in which I can change the From my point of view, Further coupling of Implementation proposalCurrent stateIn
ProposalTo me, it would make more sense to:
I agree that backwards compatibility should be preserved in any case, as it seems possible. |
The key figuring out the differences between Wilkson's "The Grammar of Graphics" and ggplot2 is Hadley's paper "The Layered Grammar". Your proposal makes sense and a lot of that is happening under the hood, it is just less obvious. What you wish for as a per panel |
If this was to be implemented, I think the most logical UI would be something like: facet_grid(Magnitude~., scales = list(x = "fixed", y = list(sc1, sc2, sc3)) But I don't really like matching up scales to rows/columns by positions. You're losing all the semantics of the facetting. |
I propose we close this - it is highly unlikely to be added to facet_grid in the near future, if ever. Also, I have some planned facet extensions for ggforce that might solve the problem... |
I would also like to have this feature ... It is very important for scientific plotting. The problem is that you want to be able to have plots that are comparable, i.e., on the same scale (like all the concentrations that were measured) in different analyses. I suppose for publications you can plot each facet separately and them combine them but this is a lot of work for exploratory analyses. |
I also would appreciate this feature. The geom_blank hack doesn't work to narrow the coord_cartesian parameter. Common in data I work with to have a range of appropriate y scales with in a group to be facetted on same x axis. |
Was this feature implemented? |
I hope it had been implemented, but as far as I know it is not possible. I am using |
I would also be happy to see this feature implemented in the future. |
This can be implemented using the scales argument in facet_grid: p1 <- ggplot(data=df2, aes(x=condition, y=dose)) + geom_boxplot(outlier.color=NA) Arguments for scales can be "free", "free_x", "free_y", or the default, "fixed" |
No, it can not. Read for instance my first example in the issue where I want one facet with percentages and another with scientific notation. I even took the time to put a screenshot. |
I hope developers can add functions that support manipulate scales of each facet, sometimes we only need a sub-range of y to enlarge the visualization of variance, but plot like geom_area doesn't support change the y label of one of the facets . |
I would also highly appreciate this feature in facet_grid! |
This can be used in facetting plots that share one axis but have different units in the other axis (@zeehio, tidyverse#1613).
This can be used in facetting plots that share one axis but have different units in the other axis (@zeehio, tidyverse#1613).
This can be used in facetting plots that share one axis but have different units in the other axis (@zeehio, tidyverse#1613).
For those of you interested in this feature, I wrote a ggplot extension package at https://github.com/zeehio/facetscales If you can open issues there with reproducible examples showing what you need, I will try to improve the interface to cope with your needs and once I have a stable and well tested functionality, I will submit a pull request to ggplot2. |
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/ |
This feature request first shows a ggplot2 limitation through an example and then it proposes a syntax change to the
scale_*
functions to overcome the scale limitation. The syntax change is designed so it feels natural to ggplot2 users. No implementation is provided, as I don't know if this syntax has chances to be merged and I would need some pointers to tackle the implementation as cleanly as possible. Discussion/help/comments are welcome.Current ggplot2 limitation
Faceted plots in ggplot2 apparently require the same scale parameters. This means that it is impossible to plot a percentage (
scale_y_continuous(labels=scales::percent_format())
) and a scientific number (scale_y_continuous(labels=scales::scientific_format())
) on the same axis but different facet.This is not a new issue (2010) but I have not seen any solution on that thread.
This issue is better described in an example:
Proposal
The syntax I would like to suggest is to allow to pass
data
andmapping
parameters to the scale functions (herescale_y_continuous
) that would map the scale arguments to each facet.geom_*
functions) and tidy.The text was updated successfully, but these errors were encountered: