I am trying to plot this data frame on one line graph (with points) using ggplot2, i have managed it on excel easy enough but i would like to generate it in R.
Wakatobi <- read.table("Wakatobi SST.txt", header=T)
Wakatobi
I am trying to plot this data frame on one line graph (with points) using ggplot2, i have managed it on excel easy enough but i would like to generate it in R.
Wakatobi <- read.table("Wakatobi SST.txt", header=T)
Wakatobi
You need to first melt your data using reshape.
df <- data.frame(Month = c("Jan", "Feb", "Mar", "Apr"),
Var1 = rnorm(4),
Var2 = rnorm(4) + 1)
df2 <- melt(df, id.vars="Month", measure.vars=c("Var1", "Var2"))
ggplot(df2, aes(x=Month, y=value, group=variable, color=variable)) + geom_point() + geom_line()