In base R plot we have las option to rotate axis labels.
Is there a way to make labels time1
and time2
horizontal, usinig tracks() function from ggbio package?
require(ggplot2)
require(ggbio)
## make a simulated time series data set
df1 <- data.frame(time = 1:100, score = sin((1:100)/20)*10)
p1 <- qplot(data = df1, x = time, y = score, geom = "line")
df2 <- data.frame(time = 30:120, score = sin((30:120)/20)*10, value = rnorm(120-30 + 1))
p2 <- ggplot(data = df2, aes(x = time, y = score)) +
geom_line() + geom_point(size = 4, aes(color = value))
#plot
tracks(time1 = p1,time2 = p2)
The ggbio
function does not seem to include such option. You could do your own ggplot.
df1$value = NA
df1$times = "time1"
df2$times = "time2"
df3 = rbind(df1, df2)
ggplot(data = df3, aes(x = time, y = score)) +
facet_grid(times~.) +
geom_line() +
geom_point(size = 4, aes(color = value)) +
theme(strip.text.y = element_text(angle = 0))
You still have the option to save the track
plot in SVG format and edit the SVG file using Inkscape.