Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '31825080'
ValidationKey: '31889144'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'mip: Comparison of multi-model runs'
version: 0.155.7
date-released: '2025-12-18'
version: 0.155.8
date-released: '2026-01-15'
abstract: Package contains generic functions to produce comparison plots of multi-model
runs.
authors:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: mip
Title: Comparison of multi-model runs
Version: 0.155.7
Date: 2025-12-18
Version: 0.155.8
Date: 2026-01-15
Authors@R: c(
person("David", "Klein", , "dklein@pik-potsdam.de", role = c("aut", "cre")),
person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"),
Expand Down
37 changes: 35 additions & 2 deletions R/showLinePlots.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ showLinePlots <- function(...) {
#' Create Line Plots
#'
#' Creates the line plots for showLinePlots.
#' @param vars A character vector of variables to be plotted. Defaults to all
#' @param vars A character vector of variables to be plotted. Defaults to all
#' variables in `data`.
#' @param histVars A character vector of historical variables to be plotted.
#' Defaults to `vars`.
Expand All @@ -39,6 +39,7 @@ showLinePlots <- function(...) {
#' exclude.
#' @param color.dim.manual optional vector with manual colors replacing default
#' colors of color.dim, default is \code{NULL}.
#' @param target optional string, model variable to be plotted with dots (indicating targets)
#' @param vlines period used for vertical line
#' @return Arranged plots
#' @inheritParams createAreaAndBarPlots
Expand All @@ -57,6 +58,7 @@ createLinePlots <- function(
mainReg = getOption("mip.mainReg"),
color.dim.manual = NULL,
histModelsExclude = character(),
target = NULL,
vlines = NULL
) {
# Validate function arguments.
Expand Down Expand Up @@ -135,9 +137,24 @@ createLinePlots <- function(
mapping = aes(x = .data$period, y = .data$value))
}

if (! is.null(vlines)) {
if (!is.null(vlines)) {
p1 <- p1 + geom_vline(xintercept = vlines, linetype = 3)
}

if (!is.null(target)) {

targets <- as.quitte(data) %>%
filter(!is.na(.data$value), .data$region == .env$mainReg,
.data$scenario != "historical", .data$variable == target) %>%
droplevels()

p1 <- p1 +
geom_point(data = targets,
aes(x = .data$period, y = .data$value, shape = .data$scenario)) +
guides(shape = guide_legend(title = "Target",
theme = theme(legend.direction = "vertical",)))
}

}
if (NROW(dRegiScen) == 0) {
p2 <- ggplot() + theme_minimal()
Expand All @@ -155,9 +172,25 @@ createLinePlots <- function(
color.dim.manual = color.dim.manual,
color.dim.manual.hist = color.dim.manual.hist[regiHistModels]
)

if (!is.null(vlines)) {
p2 <- p2 + geom_vline(xintercept = vlines, linetype = 3)
}

if (!is.null(target)) {

targets <- as.quitte(data) %>%
filter(!is.na(.data$value), .data$region != .env$mainReg,
.data$scenario != "historical", .data$variable == target) %>%
droplevels()

p2 <- p2 +
geom_point(data = targets,
aes(x = .data$period, y = .data$value, shape = .data$scenario)) +
guides(shape = guide_legend(title = "Target",
theme = theme(legend.direction = "vertical")))

}
}

# If a legend of the plots can be used as common legend for both plots,
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Comparison of multi-model runs

R package **mip**, version **0.155.7**
R package **mip**, version **0.155.8**

[![CRAN status](https://www.r-pkg.org/badges/version/mip)](https://cran.r-project.org/package=mip) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1158586.svg)](https://doi.org/10.5281/zenodo.1158586) [![R build status](https://github.com/pik-piam/mip/workflows/check/badge.svg)](https://github.com/pik-piam/mip/actions) [![codecov](https://codecov.io/gh/pik-piam/mip/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mip) [![r-universe](https://pik-piam.r-universe.dev/badges/mip)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -47,7 +47,7 @@ In case of questions / problems please contact David Klein <dklein@pik-potsdam.d

To cite package **mip** in publications use:

Klein D, Dietrich J, Baumstark L, Humpenoeder F, Stevanovic M, Wirth S, Führlich P, Richters O, Rüter T, Salzwedel R, Lécuyer F (2025). "mip: Comparison of multi-model runs." doi:10.5281/zenodo.1158586 <https://doi.org/10.5281/zenodo.1158586>, Version: 0.155.7, <https://github.com/pik-piam/mip>.
Klein D, Dietrich J, Baumstark L, Humpenoeder F, Stevanovic M, Wirth S, Führlich P, Richters O, Rüter T, Salzwedel R, Lécuyer F (2026). "mip: Comparison of multi-model runs." doi:10.5281/zenodo.1158586 <https://doi.org/10.5281/zenodo.1158586>, Version: 0.155.8, <https://github.com/pik-piam/mip>.

A BibTeX entry for LaTeX users is

Expand All @@ -56,9 +56,9 @@ A BibTeX entry for LaTeX users is
title = {mip: Comparison of multi-model runs},
author = {David Klein and Jan Philipp Dietrich and Lavinia Baumstark and Florian Humpenoeder and Miodrag Stevanovic and Stephen Wirth and Pascal Führlich and Oliver Richters and Tonn Rüter and Robert Salzwedel and Fabrice Lécuyer},
doi = {10.5281/zenodo.1158586},
date = {2025-12-18},
year = {2025},
date = {2026-01-15},
year = {2026},
url = {https://github.com/pik-piam/mip},
note = {Version: 0.155.7},
note = {Version: 0.155.8},
}
```
5 changes: 4 additions & 1 deletion man/createLinePlots.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion man/showLinePlots.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.