I am trying to stack dot plots using a facet in GGplot2.
My first dot plot:
plot1 <- ggplot(marathon, aes(x = MarathonTime, y = first_split_percent)) +
geom_point()
plot1
My second:
plot2 <- ggplot(marathon, aes(x=MarathonTime, y=km4week)) +
geom_point()
plot2
I am trying to stack them on top of each other as they share the same x-axis. I have tried using facet_wrap as so:
plot3 <- ggplot(marathon, aes(x = MarathonTime, y = first_split_percent)) +
geom_point() +
facet_wrap(km4week~.)
plot3
I have also played around with the 'rows = vars(km4week), cols = vars(MarathonTime)' functions but have had no luck. Is there a way to achieve what I am describing without a facet? Or am I using the Facet function incorrectly? Any help is greatly appreciated!