The second y-axis in ggplot2 is only intended to relabel an axis with a
fixed transformation. E.g. one axis in degree Celcius and one in Kelvin,
km and miles, ...
It does not rescale the variables.
It looks like you want to display two variables with unrelated units on the
same y-axis. That is not
Thank you Rui and Thierry for the suggestion, it helped me.
thanks
On Fri, Jan 8, 2021 at 6:58 AM Rui Barradas wrote:
> Hello,
>
> What about the following?
> First get the min and max of value by variable == "y1".
> Then use that range to scale up "y2".
>
> rng <- tapply(daT1$value, daT1$varia
Hello,
What about the following?
First get the min and max of value by variable == "y1".
Then use that range to scale up "y2".
rng <- tapply(daT1$value, daT1$variable, range)$y1
ggplot(data = daT1, aes(x = x, group = variable, color = variable)) +
geom_line(data = subset(daT1, variable == "y1
Hi R users,
I was trying to plot a graph with a secondary axis, and used the following
code for the data but the secondary line and secondary y -axis value did
not match. I would like to show both lines in one graph.
Any suggestions?
library(ggplot2)
library(reshape2)
daT<-structure(list(x = c(1L
4 matches
Mail list logo