mipIterations: plotIterations

View source: R/mipIterations.R

mipIterationsR Documentation

plotIterations

Description

Creates interactive line plots using ggplot and plotly. Creates one plot for each combination of values in columns not plotted via this function's arguments. If the special value "year" is passed as xAxis, color, slider or facets a list of possible column names representing years (e.g. "ttot", "tall", "t_all") is checked, the first one in names(x) is used.

Usage

mipIterations(
  plotData,
  returnGgplots = FALSE,
  xAxis = "year",
  color = NULL,
  slider = "iteration",
  facets = "region",
  facetScales = "fixed"
)

Arguments

plotData

A data frame. The actual value column must be the last. Use mip::getPlotData to get a ready-to-plot data frame from one or more gdx files.

returnGgplots

If FALSE (the default) show interactive plotly plots with slider support. Set to TRUE to return ggplots which can be customized, but are not interactive. To re-enable slider support and interactivity run lapply(ggplots, plotly::ggplotly) after customizing the ggplots.

xAxis

A string from names(x), defining which column is plotted on the x-axis of the plots. Must not be NULL.

color

A string from names(x), defining which column is plotted as color. If NULL color is not used.

slider

A string from names(x), defining which column is plotted as a slider. The slider requires plotly. If NULL no slider is used.

facets

A string from names(x), defining which column is used for grouping. A small plot (facet) is shown for each group. If NULL facets are not used.

facetScales

The 'scales' argument for facets (if used), defaults to 'fixed'. See help(facet_wrap) for more info.

Value

A list of plotly plots, if returnGgplots is TRUE a list of ggplots instead

Author(s)

Pascal Führlich

See Also

getPlotData


pik-piam/mip documentation built on April 5, 2024, 12:31 p.m.