I am creating an overlay of multiple plots. I have 2 columns for each graph (4 graphs total), with all the x values in the same units and all the y values in the same units. I'm not sure if my csv is formatted properly so that R can overlay each set of mL and mAU values independently, or if it needs to be read in a certain way.
example of my table, but it's 8 columns instead of 2
ml | mAu |
---|---|
val | val |
val | val |
Here's the csv data outputted:
dput(head(chrom))
structure(list(Chrom.1 = c("UV 1_295", "ml", "0", "0.002", "0.005",
"0.007"), X = c("", "mAU", "0.06199001", "0.0617022", "0.06154499",
"0.06143872"), Chrom.1.1 = c("UV 1_295 (1)", "ml", "0", "0.003",
"0.005", "0.007"), X.1 = c("", "mAU", "0.04090555", "0.04144096",
"0.0419024", "0.04236258"), Chrom.1.2 = c("UV 1_295 (2)", "ml",
"0.002", "0.004", "0.006", "0.008"), X.2 = c("", "mAU", "0.02393208",
"0.02436912", "0.02512711", "0.02582231"), Chrom.1.3 = c("UV 1_295 (3)",
"ml", "0.001", "0.003", "0.006", "0.008"), X.3 = c("", "mAU",
"0.0300992", "0.02977365", "0.02929245", "0.02880815")), row.names = c(NA,
6L), class = "data.frame")
I have a juryrigged version set up from what I have read from other posts but it is graphing the x values(mL) as their own lines, which I don't want.
Here's the plot I have so far:
library(readxl)
library(ggplot2)
library(reshape2)
chrom <- read.csv(file = 'Linear Gradient Composite.csv', skip = 2)
colnames(chrom) <- c("mL", "mAU", "mL1","mAU1","mL2", "mAU2", "mL3","mAU3")
chromMelt <- melt(chrom, "mL")
ggplot(chromMelt, aes(mL, value, color = variable)) + geom_line()