library(ggplot2)
df <- mtcars[, c("disp", "qsec", "cyl")]
plot1 <- ggplot(df, aes(x=cyl, y=qsec)) +
geom_point() + theme_bw()
plot2 <- ggplot(df, aes(x=disp, y=qsec, color = factor(cyl))) +
geom_line() + theme_void() + theme(legend.position = c(0.9, 0.8))
cb <- combine_plots(plot1, plot2)
plot(cb)
Run the code above in your browser using DataLab