mipArea | R Documentation |
Generic area plot function. Automatically creates facet grid from data. Optionally adds total line.
mipArea(
x,
stack_priority = c("variable", "region"),
total = TRUE,
scales = "fixed",
shorten = TRUE,
hist = NULL,
hist_source = "first",
ylab = NULL
)
x |
Data to plot. Allowed data formats: magpie or quitte. NOTE: To ensure correct conversion to quitte objects, the dimension that contains the variables must have one of the following names: variable, scenario, or model. |
stack_priority |
Name of column you want to stack. If you provide more than one column name the function will scan the columns in the given order and use the first dimension for stacking that has more than one element. |
total |
total data to plot. Allowed inputs: magpie, quitte or boolean. If total data is provided by user in magpie or quitte format it will be added to the plot. If user sets total to TRUE total will be calculated by the function and added to the plot. If total is FALSE the plot will ignore it. |
scales |
scales can be fixed ("fixed", default), free ("free"), or free in one dimension ("free_x", "free_y")? |
shorten |
Shorten variable names (default is TRUE) by removing categories only if they are identical (for short names in the legend) |
hist |
Historical data. Allowed data formats: magpie or quitte. NOTE: To ensure correct conversion to quitte objects, the dimension that contains the variables must have one of the following names: variable, scenario, model. |
hist_source |
If there are multiple historical sources the name of the source that you want to be plotted. |
ylab |
y-axis text |
David Klein, Jan Philipp Dietrich
p <- mipArea(x = mip_example_data)
# create plot with best-guess design (internally using theme_mip(size=12))
p <- mipArea(mip_example_data)
# override default theme with theme_grey and move legend to top
library(ggplot2)
p <- p + theme_grey() + theme(legend.position = "top")
# go back to theme_mip and increase font size
p <- p + theme_mip(size = 18)
# change facetting
p <- p + facet_grid(region ~ scenario)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.