I'm trying to make a simple line graph (graphing 3 different y variables) using one x-axis. I'm not receiving any error messages, but no data appears on my plot, though the axis/titles/legends do.
My code is below:
library(readxl)
JSWC_Summary_TC_Sep16 <- read_excel("~/JSWC_Results/JSWC_Summary_TC_Sep16.xlsx",
sheet = "Man")
# View(JSWC_Summary_TC_Sep16)
Data=JSWC_Summary_TC_Sep16
library(ggplot2)
library(tidyverse)
library(MASS)
names(Data)
head(Data)
colnames(Data)
# Data$N_Rate<- factor(Data$N_Rate, levels=c("0", "40", "80", "120", "160", "200", "240","280"))
Data$Scenario<- factor(Data$Scenario, levels=c("FALL", "SPRING","FALL+SPRING"))
p <-ggplot(Data, aes(x=Scenario, linetype="dashed")) +
geom_line(aes(y=Crop_Yield, color='Avg Crop Yield')) +
geom_line(aes(y=Dry_Crop_Yield, color='5 Driest Years')) +
geom_line(aes(y=Wet_Crop_Yield, color='5 Wettest Years'))
p
Here is an example data set:
~Location, ~N_Rate, ~Scenario, ~Nitrate_kg.ha, ~Nitrate_ppm, ~Crop_Yield, ~Dry_Nitrate_kg.ha, ~Dry_Nitrate_ppm, ~Dry_Crop_Yield, ~Wet_Nitrate_kg.ha, ~Wet_Nitrate_ppm, ~Wet_Crop_Yield,
"SHEB", "MAN", "FALL", 51.548, 12.8325, 41.486, 11.27, 74.488, 11.714, 93.113, 79.032, 116.218,
"SHEB", "MAN", "SPRING", 33.009, 7.504, 25.412, 6.24, 48.372, 6.344, 62.737, 33.806, 113.826,
"SHEB", "MAN", "FALL+SPRING", 20.278, 3.6815, 13.56, 2.202, 29.568, 2.3, 12.8775, 1.042, 28.34
)