Here is my attempt at it:
# I re-added the old column titles
prism_data <- read.table(text="
Cell-Line Aneuploidy.Aneuploidy.score Aneuploidy.Ploidy
ACH-000001 26 3.52
ACH-000007 8 2.28
ACH-000008 22 2.63
ACH-000012 21 2.74
ACH-000013 21 3.13
ACH-000014 8 3.07", header=TRUE)
library(tidyverse)
prism_data %>%
mutate(Cell_num = as.numeric(str_extract(`Cell.Line`, "\\d+"))) %>% # you could probably get the same effect by converting the cell line column into a factor column, but I chose this way instead (getting the number part of the cell line string)
ggplot(aes(x = Cell_num)) +
geom_line(aes(y = Aneuploidy.Aneuploidy.score), colour = "blue") +
geom_point(aes(y = Aneuploidy.Aneuploidy.score), shape = 17, size = 3, colour = "blue") +
geom_line(aes(y = Aneuploidy.Ploidy * 10), colour = "red") + # the ploidy data needs to be scaled up, so that it is roughly of the same magnitude as the score data
geom_point(aes(y = Aneuploidy.Ploidy * 10), shape = 15, size = 3, colour = "red") +
scale_y_continuous(sec.axis = sec_axis(~./10, name = "Aneuploidy.Ploidy")) + # adding a second column
theme_bw()
I wasn't able to get the x axis names the same (are they the names of cell lines?)