Open cahartin opened 8 years ago
`cmip5_comparison <- function( d, vtagname, prettylabel, normalizeYears=NA, facet=T ) { printlog( "Plotting", vtagname ) d1 <- subset( d, vtag==vtagname ) d1 <- renormalize( d1, normalizeYears ) d1$future <- d1$year > 2100 printdims( d1 ) p <- ggplot( d1, aes( year, value, color=model ) ) p <- p + geom_line( size=2 ) p <- p + geom_ribbon( aes( ymin=value-error, ymax=value+error, fill=model ), color=NA, alpha=0.5, show_guide=F ) p <- p + geom_ribbon( aes( ymin=error_min, ymax=error_max, fill=model ), color=NA, alpha=0.25, show_guide=F ) if (facet) p <- p + facet_grid( ~future, scales="free_x", space="free_x" ) p <- p + theme( strip.text.x = element_blank() ) + theme( strip.background = element_blank() ) p <- p + xlab( "Year" ) + ylab( prettylabel ) p <- p + scale_x_continuous( expand=c( 0, 0 ) ) p<- p + scale_colour_manual ("Model", values=c("CMIP5" = "firebrick1", "HECTOR" = "royalblue", "MAGICC6" = "forestgreen", "HadCRUT4" = "maroon3","MAGICC 5.3" = "purple", "HOTS" = "purple", "BATS" = "green3", "GCP"="olivedrab4", "Law Dome" = "darkgoldenrod3", "MaunaLoa" = "cyan4")) print( p )
saveplot( paste0( "cmip5_comparison_", vtagname ) ) invisible( p )
}`
`cmip5_comparison <- function( d, vtagname, prettylabel, normalizeYears=NA, facet=T ) { printlog( "Plotting", vtagname ) d1 <- subset( d, vtag==vtagname ) d1 <- renormalize( d1, normalizeYears ) d1$future <- d1$year > 2100 printdims( d1 )
p <- ggplot( d1, aes( year, value, color=model ) ) p <- p + geom_line( size=2 ) p <- p + geom_ribbon( aes( ymin=value-error, ymax=value+error, fill=model ), color=NA, alpha=0.5, show_guide=F ) p <- p + geom_ribbon( aes( ymin=error_min, ymax=error_max, fill=model ), color=NA, alpha=0.25, show_guide=F ) if (facet) p <- p + facet_grid( ~future, scales="free_x", space="free_x" ) p <- p + theme( strip.text.x = element_blank() ) + theme( strip.background = element_blank() ) p <- p + xlab( "Year" ) + ylab( prettylabel ) p <- p + scale_x_continuous( expand=c( 0, 0 ) ) p<- p + scale_colour_manual ("Model", values=c("CMIP5" = "firebrick1", "HECTOR" = "royalblue", "MAGICC6" = "forestgreen", "HadCRUT4" = "maroon3","MAGICC 5.3" = "purple", "HOTS" = "purple", "BATS" = "green3", "GCP"="olivedrab4", "Law Dome" = "darkgoldenrod3", "MaunaLoa" = "cyan4")) print( p )
}`