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
Usage of different scales #40
Comments
This definitely looks like a bug - I will have a look at what is going on this weekend. I personally do not know where in the |
I have taken an extensive look into the issue and this seems that this may not be easily added feature due to the internals of the Unfortunately, I do not think I could implement this feature without doing something either really hacky, or by writing my own I may consider doing the hacky solution since a lot of the package has clever ways to bypass the ggproto's factory methods. But I may need to put some serious thought into the long term longevity of |
Against my better judgement I have implemented the hacky solution. Hopefully it doesn't break too soon. For now it will reside in the branch here is a reprex of a very minimal case. I have yet to test with other library(ggplot2)
library(ggside)
#> Registered S3 method overwritten by 'ggside':
#> method from
#> +.gg ggplot2
df <- data.frame(
x = seq(from = 20, to = 60, by = 1),
y1 = seq(from = 0.001, to = 1, length.out = 41),
y2 = seq(from = 5000, to = 1, length.out = 41)
)
ggplot(data = df) +
geom_line(mapping = aes(x = x, y = y1, group = "obs1")) +
geom_xsideline(mapping = aes(x = x, y = y2)) +
scale_xsidey_continuous(expand = c(0, 0), trans = scales::log10_trans()) ggplot(data = df) +
geom_line(mapping = aes(x = x, y = y1, group = "obs1")) +
geom_xsideline(mapping = aes(x = x, y = y2)) +
scale_y_log10() +
scale_xsidey_continuous(expand = c(0, 0)) Created on 2022-11-12 with reprex v2.0.2 I will consider adding this as a feature if it seems safe with other facets. Please let me know if you find anything. |
I have recently decided that I will move forward with a submission to |
with the release of 0.3.0 support for this feature has been introduced. library(ggplot2)
library(ggside)
#> Registered S3 method overwritten by 'ggside':
#> method from
#> +.gg ggplot2
df <- data.frame(
x = seq(from = 20, to = 60, by = 1),
y1 = seq(from = 0.001, to = 1, length.out = 41),
y2 = seq(from = 5000, to = 1, length.out = 41)
) adding a global scale transform does not affect ggside scales unless they share a scale with the main plot. ggplot(data = df) +
geom_line(mapping = aes(x = x, y = y1, group = "obs1")) +
geom_xsideline(mapping = aes(x = x, y = y2)) +
scale_y_log10() You can still transform the side scale with a new set of functions as below. ggplot(data = df) +
geom_line(mapping = aes(x = x, y = y1, group = "obs1")) +
geom_xsideline(mapping = aes(x = x, y = y2)) +
scale_xsidey_log10(expand = c(0, 0)) It wasn't my intention originally to make native ggplot2 scale transforms not affect adjacent side scales, but I think it is a reasonable assumption as the package moved towards supporting a mixing of continuous and discrete axis combinations. I.e. data scales are inferred from the data mappings to either be continuous or discrete, and anything beyond that you must opt into explicitly. Created on 2024-02-25 with reprex v2.1.0 Thank you for your patients with this issue, I believe it is time for it to be closed. Thanks @bnorthoff |
I would like to use a log10 scale for the main plot and a continuous scale for the additonal ggside facet. Although I am able to define these scales by
scale_y_log10
andscale_xsidey_continuous
the values gets transformed:Is there a solution?
The text was updated successfully, but these errors were encountered: