histoPlot: histoPlot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/histoPlot.R

Description

Function to create a time series plot from magpie objects.

Usage

1
2
3
4
5
histoPlot(magpie, historical=NULL, projection=NULL, years=NULL, 
          xlim=NULL, ylim=NULL, index=FALSE, same_yscale=TRUE, 
          text_size=15, title="", ylab="", 
          legend_names=c("Model output","Historical Data","Other projections"),
          raw_plot=FALSE, raw_legend=FALSE)

Arguments

magpie

A magpie object to be plotted or a named list of magpie objects. Only one data column allowed.

historical

A magpie object with historical data or a named list of such magpie objects. Either one data column or three with naming c("data","up","lo") for uncertainty specification.

projection

A magpie object with projection data or a named list of such magpie objects. Either one data column or three with naming c("data","up","lo") for uncertainty specification.

years

A vector specifying the first and last year displayed. Has to be provided as integer years, eg: years=c(1980,2045). For one sided limits, set the other one to NA, e.g. c(NA,2065) or c(1960,NA).

xlim

Similar to the years argument. For back compatibility only.

ylim

A vector specifying limits for the y axis.

index

Y axis diesplays absolute values (FALSE) or index wrt to model output in the first simulation year (TRUE)

same_yscale

If level=="reg", should all regions have the same y axis (TRUE) or individual ones (FALSE).

text_size

Size of the text in the plot

title

Title of the plot

ylab

Y label

legend_names

A vector of length three. Determines the legend titles for Model output, Historical data and Other projections.

raw_plot

If FALSE, the complete plot is returned. If TRUE, a list with the actual plot, the legend and the function to combine both is returned. See Value

raw_legend

Works only with raw_plot=TRUE. If FALSE, the complete legend is returned. If TRUE, a list with the individual legend components and the function to combine both is returned. See Value.

Value

If raw_plot is FALSE, the plot is returned as a full object. No easy manipulations are possible. If raw_plot is TRUE, a list of three objects is returned. The first element is the actual plot and can be modified in a normal way using ggplot2 routines. The second element contains the legend. The third element contains the function to combine both to the plot that is returned if raw_plot=FALSE. If raw_legend is TRUE, the legend element of the returned list contains the individual legend components, the widths for arranging and a function to combine the legends.

Author(s)

Markus Bonsch

See Also

addData,getData,validationPlot,addMapping

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
#Normal routine without modifications
test<-histoPlot(magpie=x)
print(test)

#including modifications of the plot
test<-histoPlot(magpie=x,raw_plot=TRUE)
test$figure<-test$figure+geom_hline(yintercept=2)
out<-test$combine(test)
print(out)

## End(Not run)

pik-piam/validation documentation built on Nov. 5, 2019, 12:50 a.m.