diff --git a/.buildlibrary b/.buildlibrary index f7d0235..ea00a03 100644 --- a/.buildlibrary +++ b/.buildlibrary @@ -1,4 +1,4 @@ -ValidationKey: '71528436' +ValidationKey: '71809940' AutocreateReadme: yes AcceptedWarnings: - 'Warning: package ''.*'' was built under R version' diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 46f518a..f6ea5d4 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: r-lib/actions/setup-pandoc@v2 @@ -23,7 +23,6 @@ jobs: - uses: r-lib/actions/setup-r-dependencies@v2 with: extra-packages: | - gamstransfer=?ignore any::lucode2 any::covr any::madrat @@ -36,7 +35,7 @@ jobs: # gms, goxygen, GDPuc) will usually have an outdated binary version # available; by using extra-packages we get the newest version - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 with: python-version: 3.9 diff --git a/CITATION.cff b/CITATION.cff index 7ac5793..fe99862 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -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: 'luplot: Landuse Plot Library' -version: 3.61.2 -date-released: '2024-03-21' +version: 3.62.0 +date-released: '2024-04-24' abstract: Some useful functions to plot data such as a map plot function for MAgPIE objects. authors: diff --git a/DESCRIPTION b/DESCRIPTION index 794725c..1fac18b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: luplot Title: Landuse Plot Library -Version: 3.61.2 -Date: 2024-03-21 +Version: 3.62.0 +Date: 2024-04-24 Authors@R: c( person("Benjamin Leon", "Bodirsky", , "bodirsky@pik-potsdam.de", role = c("aut", "cre")), person("Jan Philipp", "Dietrich", , "dietrich@pik-potsdam.de", role = "aut"), diff --git a/NAMESPACE b/NAMESPACE index a2b2b2e..8461410 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -28,7 +28,6 @@ export(plotmap) export(plotmap2) export(plotmap_discrete) export(plotregionscluster) -export(plotspam) export(qualityMeasure) export(scratch_legend) export(scratch_plot) @@ -128,8 +127,6 @@ importFrom(graphics,polygon) importFrom(graphics,text) importFrom(graphics,title) importFrom(gridExtra,marrangeGrob) -importFrom(luscale,read.spam) -importFrom(luscale,speed_aggregate) importFrom(luscale,superAggregate) importFrom(lusweave,swfigure) importFrom(lusweave,swtable) @@ -138,7 +135,6 @@ importFrom(magclass,"getRegions<-") importFrom(magclass,"getSets<-") importFrom(magclass,"getYears<-") importFrom(magclass,as.data.frame) -importFrom(magclass,as.magpie) importFrom(magclass,collapseNames) importFrom(magclass,dimSums) importFrom(magclass,fulldim) @@ -171,11 +167,9 @@ importFrom(sp,plot) importFrom(stats,as.formula) importFrom(stats,cor) importFrom(stats,cor.test) -importFrom(stats,kmeans) importFrom(stats,na.omit) importFrom(stats,quantile) importFrom(stats,reshape) -importFrom(stats,runif) importFrom(stats,weighted.mean) importFrom(utils,data) importFrom(utils,head) diff --git a/R/plotregioncluster.R b/R/plotregioncluster.R index 58fe6d7..3043c6b 100644 --- a/R/plotregioncluster.R +++ b/R/plotregioncluster.R @@ -9,7 +9,6 @@ #' For 67420 cells: cell dimension with coordinate and country name information #' and format of cluster dimension \code{region.cluster} #' @param cells "magpiecell" for 59199 cells and "lpjcell" for 67420 cells -#' @seealso \code{\link{plotspam}} #' @importFrom data.table data.table #' @importFrom ggplot2 scale_fill_manual theme_linedraw scale_alpha_continuous geom_tile #' @importFrom mip plotstyle diff --git a/R/plotspam.R b/R/plotspam.R deleted file mode 100644 index a07941b..0000000 --- a/R/plotspam.R +++ /dev/null @@ -1,51 +0,0 @@ -#' Plots Spam object as map -#' -#' Function to plot spam relation objects as maps -#' -#' -#' @usage plotspam(spam,type="pdf",name="spamplot", folder=".",color="brewer") -#' @param spam A spam relation object (either object itself or file name of a -#' spam object) -#' @param type output type: "screen", "pdf", or "png" -#' @param name name to be used in file name -#' @param folder folder the output should be written to -#' @param color brewer: 12 colors iterating, random: (number of cluster)-different colors -#' @author Jan Philipp Dietrich, Kristine Karstens -#' @seealso \code{\link{map2image}} -#' @examples -#' -#' \dontrun{plotspam("0.5-to-h100.spam")} -#' @export -#' @importFrom grDevices rgb -#' @importFrom stats kmeans runif -#' @importFrom luscale read.spam speed_aggregate -#' @importFrom magclass as.magpie - - - -plotspam <- function(spam,type="pdf",name="spamplot",folder=".", color="brewer") { - #require("RColorBrewer", quietly = TRUE) - #require("luscale", quietly = TRUE) - - if(is.character(spam)) spam <- read.spam(spam) - - test <- 1:dim(spam)[1] - names(test) <- paste("GLO",test,sep=".") - test <- as.magpie(test) - plot <- speed_aggregate(test,rel=t(spam)) - - if(color=="brewer"){ - palette=c(rep(brewer.pal(12, "Set3"),dim(spam)[1] %/% 12),brewer.pal(dim(spam)[1] %% 12, "Set3")) - - } else if(color=="random"){ - - n <- 10000 - k <- dim(spam)[1] - ColorSpace <- array(c(runif(n), runif(n), runif(n)), c(n,3)) - km <- kmeans(ColorSpace, k, iter.max=20) - palette <- rgb(km$centers) - - } else stop("Color scheme is not available.") - - map2image(plot,name=name,folder=folder,type=type,legend_range=c(0,dim(spam)[1]),legend_colours=palette) -} diff --git a/README.md b/README.md index 2b470ba..7d0f946 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Landuse Plot Library -R package **luplot**, version **3.61.2** +R package **luplot**, version **3.62.0** [![CRAN status](https://www.r-pkg.org/badges/version/luplot)](https://cran.r-project.org/package=luplot) [![R build status](https://github.com/pik-piam/luplot/workflows/check/badge.svg)](https://github.com/pik-piam/luplot/actions) [![codecov](https://codecov.io/gh/pik-piam/luplot/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/luplot) [![r-universe](https://pik-piam.r-universe.dev/badges/luplot)](https://pik-piam.r-universe.dev/builds) @@ -39,7 +39,7 @@ In case of questions / problems please contact Benjamin Bodirsky . +Bodirsky B, Dietrich J, Krause M, Stevanovic M, Humpenoeder F, Weindl I, Baumstark L, Klein D, Rolinski S, Wang X, Chen D (2024). _luplot: Landuse Plot Library_. R package version 3.62.0, . A BibTeX entry for LaTeX users is @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is title = {luplot: Landuse Plot Library}, author = {Benjamin Leon Bodirsky and Jan Philipp Dietrich and Michael Krause and Miodrag Stevanovic and Florian Humpenoeder and Isabelle Weindl and Lavinia Baumstark and David Klein and Susanne Rolinski and Xiaoxi Wang and David Chen}, year = {2024}, - note = {R package version 3.61.2}, + note = {R package version 3.62.0}, url = {https://github.com/pik-piam/luplot}, } ``` diff --git a/man/plotregionscluster.Rd b/man/plotregionscluster.Rd index a9003a3..573b877 100644 --- a/man/plotregionscluster.Rd +++ b/man/plotregionscluster.Rd @@ -24,6 +24,3 @@ Plots world map showing world regions and cluster. x <- paste(rep(paste0("REG", 1:5), each = 12000), rep(1:25, each = 2400), sep = ".")[1:59199] plotregionscluster(x) } -\seealso{ -\code{\link{plotspam}} -} diff --git a/man/plotspam.Rd b/man/plotspam.Rd deleted file mode 100644 index 5a69c44..0000000 --- a/man/plotspam.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/plotspam.R -\name{plotspam} -\alias{plotspam} -\title{Plots Spam object as map} -\usage{ -plotspam(spam,type="pdf",name="spamplot", folder=".",color="brewer") -} -\arguments{ -\item{spam}{A spam relation object (either object itself or file name of a -spam object)} - -\item{type}{output type: "screen", "pdf", or "png"} - -\item{name}{name to be used in file name} - -\item{folder}{folder the output should be written to} - -\item{color}{brewer: 12 colors iterating, random: (number of cluster)-different colors} -} -\description{ -Function to plot spam relation objects as maps -} -\examples{ - -\dontrun{plotspam("0.5-to-h100.spam")} -} -\seealso{ -\code{\link{map2image}} -} -\author{ -Jan Philipp Dietrich, Kristine Karstens -}