that's my code:
ggplot(df, aes(Date, EC))+
scale_x_date(labels= date_format("%Y"), breaks=date_breaks("year"))+
geom_point(data=df2, aes(Date, EC), size=2, color="red")+
geom_point()+
geom_line()+
xlab(NULL)+
geom_smooth(method="lm", se=F)+
facet_wrap(~ID, scales="free_y")+
theme(axis.text.x = element_text(angle = 90))
That produce this result (I know it's ugly, but take it just as an example):
Can I specify different xlim (base on date values) for each plot in facet_wrap? It would be great if I can specify xlim based on the min(df$Date).
I hope I made myself clear.
This should be solved. Trying on some wide ranged data:
data <- data.frame( grp=rep(c("one","two","three","four"), each=10),
x=1:40,
y=c( runif(10)*3,
( runif(10)*30 )+10,
( runif(10)*50 )+10,
( runif(10)*10 )-10 ) )
ggplot( data, aes(x, y) ) +
geom_point( ) +
geom_line( ) +
geom_smooth( method = "loess" ) +
facet_wrap( ~grp, scales="free" )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With