-
-
Notifications
You must be signed in to change notification settings - Fork 45
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
Marginal plots don't reflect axis limits made using coordinate system (e.g., coord_cartesian()) #128
Comments
Turns out this is a really hairy issue. I think it can be fixed, but it leads to some very confusing code, so much so that I'm not sure it's worth it to fix. |
Axis limits are basic plot attributes. Is there any way to specify axis limits for the marginal plots? |
Do you mean you want to set the limits of the marginal plots to be different from the limits used in the scatter plot? |
I want the limits to be the same in the scatter and box plots. I’m setting scatter plot limits with |
Try using xlim/ylim or scale_x_continuous/scale_y_continuous: library(ggplot2)
library(ggExtra)
p <- ggplot(mtcars) +
geom_point(aes(wt, drat)) +
xlim(c(4, 5.5))
ggMarginal(p)
#> Warning: Removed 28 rows containing missing values (geom_point). Created on 2019-06-03 by the reprex package (v0.2.0.9000). |
Using xlim/ylim or scale_x_continuous work so that the marginal plots adapt to the same axis, which works welll for scatterplots but not for additional line plots as they are cut at the limits even if the shown axis extends a bit further. |
Hmm, my first thought is probably not, there won't be a way to do that b/c it will require coord_cartesian. If you can provide an example of the type of behavior that you're seeing and what you would prefer to see, I can take a closer look at it. |
Thank you for considering my request!
|
Hi @pricklpitty , thanks for clarifying/for the good examples. Unfortunately what you want to do would require a fix to how ggMarginal deals with the the "cartesian" coordinate system (i.e., a fix to the issue originally reported here), which isn't easy. We've decided not to attempt to fix this issue for now, as it would introduce quite a bit of complexity into the code. |
Hi @crew102, thank you for your response. Yes, it would require to fix the original issue posted here. Unfortunately, I am still struggling with this issue, e.g. trying to use dummy data to fix the limits, but I do not succeed in matching boxplots AND continue the line to figure limits, I can only produce one of the targets at once... Do you have any workaround suggestion for me? |
Hmm, yeah, sorry, I can't think of one. |
As mentioned by @Futats in #75
Created on 2018-08-15 by the reprex package (v0.2.0).
The text was updated successfully, but these errors were encountered: