Hi there,
I am trying to create a mean line plot that shows the mean of a series of 
separate line plots that correspond to two climate models. Let's first try 
getting the mean of two line plots. To create the separate line plots, here is 
what I did to set up the x and y axis variables:

####Getting cumulative emissions data for x-axis: 1-dimensional ####

#For CanESM model#

ncfname <- "cumulative_emissions_1pctCO2.nc"
Model1 <- nc_open(ncfname)
get <- ncvar_get(Model1, "cum_co2_emi-CanESM2")     #units of terratones of 
carbon (TtC) for x-axis (140 values)
#For IPSL LR Model#
#Getting cumulative emissions data for x-axis IPSL LR 1pctCO2 IPSL <- 
ncvar_get(Model1, "cum_co2_emi-IPSL-CM5A-LR")     #units of terratones of 
carbon (TtC) for x-axis (140 values)

############################################################################################################

#####Getting precipitation data for y-axis - these are 3-dimensional####

#For CanESM2 model#
Model2 <- brick("MaxPrecCCCMACanESM21pctCO2.nc", var="onedaymax")


#For IPSL LR Model#
Model10 <- brick("MaxPrecIPSLIPSL-CM5A-LR1pctCO2.nc", var="onedaymax")
#############################################################################################################
To create plots for a specific location:
lonlat <- cbind(103,3)          #specifies a specific longitude and latitude
Hope2 <- extract(Model2,lonlat)      #CanESM2
Hope6 <- extract(Model10,lonlat)   #start IPSL CM5A LR
plot(get,Hope2, type="l",col="green", lwd="3", xlab="Cumulative CO2 emissions 
(TtC)", ylab="One-day maximum precipitation (mm/day)", main="One-day maximum 
precipitation for random location for 1pctCO2 scenario")
lines(IPSL, Hope6, type="l", lwd="3", col="green")
#############################################################################################################
So, the idea would be to create a plot that shows the mean of these two plots. 
Given what I showed above, how should I go about creating the mean of these two 
green line plots? Would you have to get the mean of the x-values, and then 
obtain the mean of the y-values, and then plot these?
Thanks, and any help would be greatly appreciated!
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to