Skip to content

Commit

Permalink
Merge pull request #48 from m-jahn/dev
Browse files Browse the repository at this point in the history
various fixes for CRAN release 0.1.2
  • Loading branch information
m-jahn authored Jan 8, 2024
2 parents 25774d9 + 5ead5dc commit 10ac991
Show file tree
Hide file tree
Showing 18 changed files with 263 additions and 257 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: WeightedTreemaps
Title: Generate and Plot Voronoi or Sunburst Treemaps from Hierarchical
Data
Version: 0.1.1
Version: 0.1.2
Authors@R: c(
person("Michael", "Jahn", , "[email protected]", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-3913-153X")),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# WeightedTreemaps 0.1.2

# WeightedTreemaps 0.1.1

- The package was prepared for release on CRAN
- A Shiny app for generating treemaps from custom data is now
available at [Shinyapps.io](https://m-jahn.shinyapps.io/ShinyTreemaps/)
available at [Shinyapps.io](https://m-jahn.shinyapps.io/ShinyTreemaps/)
53 changes: 28 additions & 25 deletions R/drawTreemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,41 +75,44 @@
#' the input for the drawing function
#'
#' @examples
#' # load example data
#' data(mtcars)
#' mtcars$car_name = gsub(" ", "\n", row.names(mtcars))
#' # load package
#' library(WeightedTreemaps)
#'
#' # generate treemap; set seed to obtain same pattern every time
#' # generate dummy data
#' df <- data.frame(
#' A = rep(c("abcd", "efgh"), each = 4),
#' B = letters[1:8],
#' size = c(37, 52, 58, 27, 49, 44, 34, 45)
#' )
#'
#' # compute treemap
#' tm <- voronoiTreemap(
#' data = mtcars,
#' levels = c("gear", "car_name"),
#' cell_size = "wt",
#' shape = "rounded_rect",
#' data = df,
#' levels = c("B"),
#' cell_size = "size",
#' shape = "circle",
#' positioning = "regular",
#' seed = 123
#' )
#'
#' # draw treemap
#' drawTreemap(tm, label_size = 2)
#' # plot treemap with each cell colored by name (default)
#' drawTreemap(tm, label_size = 1, color_type = "categorical")
#'
#' # draw different variants of the same treemap on one page using
#' # the 'layout' and 'position' arguments (indicating rows and columns)
#' drawTreemap(tm, title = "treemap 1", label_size = 2,
#' color_type = "categorical", color_level = 1,
#' layout = c(1,3), position = c(1, 1))
#' # plot treemap with each cell colored by name, but larger cells
#' # lighter and smaller cells darker
#' drawTreemap(tm, label_size = 1, color_type = "both")
#'
#' drawTreemap(tm, title = "treemap 2", label_size = 2,
#' color_type = "categorical", color_level = 2, border_size = 3,
#' add = TRUE, layout = c(1,3), position = c(1, 2))
#'
#' drawTreemap(tm, title = "treemap 3", label_size = 2,
#' color_type = "cell_size", color_level = 2,
#' color_palette = heat.colors(10),
#' border_color = grey(0.4), label_color = grey(0.4),
#' add = TRUE, layout = c(1,3), position = c(1, 3),
#' title_color = "black")
#' # plot treemap with different color palette and style
#' drawTreemap(tm, label_size = 1, label_color = grey(0.3),
#' border_color = grey(0.3), color_palette = heat.colors(6)
#' )
#'
#' # ---------------------------------------------
#'
#' # load example data
#' data(mtcars)
#' mtcars$car_name = gsub(" ", "\n", row.names(mtcars))
#'
#' # generate sunburst treemap
#' tm <- sunburstTreemap(
#' data = mtcars,
Expand Down
49 changes: 24 additions & 25 deletions R/voronoiTreemap.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,37 @@
#' @seealso \code{\link{drawTreemap}} for drawing the treemap.
#'
#' @examples
#' # load example data
#' data(mtcars)
#' mtcars$car_name = gsub(" ", "\n", row.names(mtcars))
#' # load package
#' library(WeightedTreemaps)
#'
#' # generate treemap; set seed to obtain same pattern every time
#' # generate dummy data
#' df <- data.frame(
#' A = rep(c("abcd", "efgh"), each = 4),
#' B = letters[1:8],
#' size = c(37, 52, 58, 27, 49, 44, 34, 45)
#' )
#'
#' # compute treemap
#' tm <- voronoiTreemap(
#' data = mtcars,
#' levels = c("gear", "car_name"),
#' cell_size = "wt",
#' shape = "rounded_rect",
#' data = df,
#' levels = c("B"),
#' cell_size = "size",
#' shape = "circle",
#' positioning = "regular",
#' seed = 123
#' )
#'
#' # draw treemap
#' drawTreemap(tm, label_size = 2)
#' # plot treemap with each cell colored by name (default)
#' drawTreemap(tm, label_size = 1, color_type = "categorical")
#'
#' # draw different variants of the same treemap on one page using
#' # the 'layout' and 'position' arguments (indicating rows and columns)
#' drawTreemap(tm, title = "treemap 1", label_size = 2,
#' color_type = "categorical", color_level = 1,
#' layout = c(1,3), position = c(1, 1))
#' # plot treemap with each cell colored by name, but larger cells
#' # lighter and smaller cells darker
#' drawTreemap(tm, label_size = 1, color_type = "both")
#'
#' drawTreemap(tm, title = "treemap 2", label_size = 2,
#' color_type = "categorical", color_level = 2, border_size = 3,
#' add = TRUE, layout = c(1,3), position = c(1, 2))
#'
#' drawTreemap(tm, title = "treemap 3", label_size = 2,
#' color_type = "cell_size", color_level = 2,
#' color_palette = heat.colors(10),
#' border_color = grey(0.4), label_color = grey(0.4),
#' add = TRUE, layout = c(1,3), position = c(1, 3),
#' title_color = "black")
#' # plot treemap with different color palette and style
#' drawTreemap(tm, label_size = 1, label_color = grey(0.3),
#' border_color = grey(0.3), color_palette = heat.colors(6)
#' )
#'
#' @importFrom Rcpp evalCpp
#' @importFrom grid grid.newpage
Expand Down
21 changes: 17 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
output: github_document
title: "WeightedTreemaps"
author: "Michael Jahn, David Leslie, Ahmadou Dicko"
author: "Michael Jahn, David Leslie, Ahmadou Dicko, Paul Murrell"
date: "`r Sys.Date()`"
vignette: >
%\VignetteIndexEntry{WeightedTreemaps}
Expand All @@ -21,7 +21,8 @@ knitr::opts_chunk$set(
<img src="images/logo.png" align="right" />

<!-- badges start -->
[![R build status](https://github.com/m-jahn/WeightedTreemaps/workflows/R-CMD-check/badge.svg)](https://github.com/m-jahn/WeightedTreemaps/actions)
[![CRAN status](https://www.r-pkg.org/badges/version/WeightedTreemaps)](https://CRAN.R-project.org/package=WeightedTreemaps)
[![R-CMD-check](https://github.com/m-jahn/WeightedTreemaps/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/m-jahn/WeightedTreemaps/actions/workflows/R-CMD-check.yaml)
![GitHub issues](https://img.shields.io/github/issues/m-jahn/WeightedTreemaps)
![GitHub last commit](https://img.shields.io/github/last-commit/m-jahn/WeightedTreemaps)
![Platform](https://img.shields.io/badge/platform-all-green)
Expand Down Expand Up @@ -57,6 +58,12 @@ drawTreemap(tm, label_size = 2.5, label_color = "white", title = "An example")

## News

*14 December 2023*

The package was finally released on CRAN!
Prerequisite was testing and troubleshooting of C++ related compilation problems,
and re-release of the CGAL dependency package `RcppCGAL` with latest version.

*25 March 2021*

A **Shiny app** for generating treemaps from custom data is now available on **[Shinyapps.io](https://m-jahn.shinyapps.io/ShinyTreemaps/)!**
Expand All @@ -76,11 +83,17 @@ The **Sunburst treemap** is a computationally less demanding treemap that does n

The C++ code computing the actual Voronoi tesselation requires the [CGAL](https://www.cgal.org/download.html) library headers. Thanks to [Ahmadou Dicko](https://github.com/dickoa), installing the complete CGAL library locally is no longer necessary. Instead, the package depends on the CGAL headers that are available as R packages on CRAN. The package was using CGAL 4 (package `cgal4h`), but now moved to the latest CGAL 5.5+ version available as package `RcppCGAL`. The dependencies are usually installed automatically and manual installation of CGAL (headers) should not be necessary.

**NOTE**: The `RcppCGAL` package is currently (September 2023) not available on CRAN! Please install it [manually from Github](https://github.com/ericdunipace/RcppCGAL).
Note: If the `RcppCGAL` package is temporarily not available on CRAN (as happened 2023), please install it [manually from Github](https://github.com/ericdunipace/RcppCGAL).

## Installation

To install the package directly from github, use the following function from the `devtools` package in your R session:
To install the package from CRAN, use:

```{r, eval = FALSE}
install.packages("WeightedTreemaps")
```

To install the package directly from github, use the following function from the `devtools` package:

```{r, eval = FALSE}
devtools::install_github("m-jahn/WeightedTreemaps")
Expand Down
37 changes: 25 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
WeightedTreemaps
================
Michael Jahn, David Leslie, Ahmadou Dicko
2023-12-12
Michael Jahn, David Leslie, Ahmadou Dicko, Paul Murrell
2024-01-07

<!-- include logo-->

<img src="images/logo.png" align="right" />

<!-- badges start -->

[![R build
status](https://github.com/m-jahn/WeightedTreemaps/workflows/R-CMD-check/badge.svg)](https://github.com/m-jahn/WeightedTreemaps/actions)
[![CRAN
status](https://www.r-pkg.org/badges/version/WeightedTreemaps)](https://CRAN.R-project.org/package=WeightedTreemaps)
[![R-CMD-check](https://github.com/m-jahn/WeightedTreemaps/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/m-jahn/WeightedTreemaps/actions/workflows/R-CMD-check.yaml)
![GitHub
issues](https://img.shields.io/github/issues/m-jahn/WeightedTreemaps)
![GitHub last
Expand All @@ -28,6 +29,12 @@ hierarchical data.

## News

*14 December 2023*

The package was finally released on CRAN! Prerequisite was testing and
troubleshooting of C++ related compilation problems, and re-release of
the CGAL dependency package `RcppCGAL` with latest version.

*25 March 2021*

A **Shiny app** for generating treemaps from custom data is now
Expand Down Expand Up @@ -83,14 +90,20 @@ was using CGAL 4 (package `cgal4h`), but now moved to the latest CGAL
usually installed automatically and manual installation of CGAL
(headers) should not be necessary.

**NOTE**: The `RcppCGAL` package is currently (September 2023) not
available on CRAN! Please install it [manually from
Note: If the `RcppCGAL` package is temporarily not available on CRAN (as
happened 2023), please install it [manually from
Github](https://github.com/ericdunipace/RcppCGAL).

## Installation

To install the package from CRAN, use:

``` r
install.packages("WeightedTreemaps")
```

To install the package directly from github, use the following function
from the `devtools` package in your R session:
from the `devtools` package:

``` r
devtools::install_github("m-jahn/WeightedTreemaps")
Expand Down Expand Up @@ -135,7 +148,7 @@ Draw the treemap.
drawTreemap(tm, label_size = 2.5, label_color = "white")
```

<img src="images/unnamed-chunk-6-1.png" width="50%" style="display: block; margin: auto;" />
<img src="images/unnamed-chunk-7-1.png" width="50%" style="display: block; margin: auto;" />

The `voronoiTreemap()` and `drawTreemap()` functions are separated in
order to allow drawing of the same treemap object in different ways.
Expand Down Expand Up @@ -170,7 +183,7 @@ drawTreemap(tm, title = "treemap 4", label_size = 2,
title_color = "black", legend = TRUE)
```

<img src="images/unnamed-chunk-7-1.png" width="100%" style="display: block; margin: auto;" />
<img src="images/unnamed-chunk-8-1.png" width="100%" style="display: block; margin: auto;" />

### Positioning of cells

Expand Down Expand Up @@ -223,7 +236,7 @@ drawTreemap(tm3, title = "positioning = 'clustered'", border_size = 3,
add = TRUE, layout = c(1,3), position = c(1, 3))
```

<img src="images/unnamed-chunk-9-1.png" width="100%" style="display: block; margin: auto;" />
<img src="images/unnamed-chunk-10-1.png" width="100%" style="display: block; margin: auto;" />

### Custom initial shapes

Expand Down Expand Up @@ -271,7 +284,7 @@ drawTreemap(tm2, add = TRUE, layout = c(1,3), position = c(1, 2))
drawTreemap(tm3, add = TRUE, layout = c(1,3), position = c(1, 3))
```

<img src="images/unnamed-chunk-12-1.png" width="100%" style="display: block; margin: auto;" />
<img src="images/unnamed-chunk-13-1.png" width="100%" style="display: block; margin: auto;" />

### Advanced example for Voronoi treemaps

Expand Down Expand Up @@ -546,7 +559,7 @@ drawTreemap(tm,
)
```

<img src="images/unnamed-chunk-22-1.png" width="100%" style="display: block; margin: auto;" />
<img src="images/unnamed-chunk-23-1.png" width="100%" style="display: block; margin: auto;" />

## References and other treemap packages

Expand Down
45 changes: 6 additions & 39 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
## Resubmission

This package was submitted previously, but returned with the following comments:

1. "If there are references describing the methods in your package, please
add these in the description field of your DESCRIPTION file ..."

-> one reference was added to the DESCRIPTION.

2. "Please add \value to .Rd files regarding exported methods and explain
the functions results in the documentation. Please write about the
structure of the output (class) ... Missing Rd-tags: poly_sortpoints.Rd: \value"

-> the documentation in \value fields was extended for several functions.
The function with a missing \value was removed.

3. "You write information messages to the console that cannot be easily
suppressed. It is more R like to generate objects that can be used to extract the
information a user is interested in, and then print() that object.
Instead of print()/cat() rather use message()/warning() ..."

-> all cat() and print() statements were replaced by message(). Messages are
now only printed when the user specifies verbose = TRUE.
## Update

## Test environments

Expand All @@ -32,33 +10,19 @@ now only printed when the user specifies verbose = TRUE.
- ubuntu-latest (release)
- ubuntu-latest (oldrel-1)


### with `rhub::check_for_cran()`

- Fedora Linux, R-devel, clang, gfortran
- Debian Linux, R-release, GCC
- Windows Server 2022, R-devel, 64 bit
- Ubuntu Linux 20.04.1 LTS, R-release, GCC
- Debian Linux, R-devel, GCC ASAN/UBSAN

## R CMD check results

There were no ERRORs or WARNINGs.

There were 2 NOTEs:

1. Note:

```
File ‘WeightedTreemaps/libs/WeightedTreemaps.so’:
Found ‘__ZNSt3__14cerrE’, possibly from ‘std::cerr’ (C++)
Object: ‘voronoiDiagram.o’. Compiled code should not call entry
points which might terminate R nor write to stdout/stderr instead
of to the console, nor use Fortran I/O nor system RNGs.
```

The C++ function `voronoiDiagram.cpp` does not contain any such entry points. This Note occasionally turns up on Mac OS tests, probably caused by the upstream dependency CGAL headers (R package `RcppCGAL`) or boost headers (`BH`).

2. Note:
There was 1 NOTE:

```
checking installed package size ... NOTE
Expand All @@ -70,6 +34,9 @@ checking installed package size ... NOTE

Installed package size exceeding 5 MB is caused by the compiled function `voronoiDiagram.o`. The size of this file can not be reduced.

There were "additional issues" brought up with from ASAN/UBSAN sanitizer checks.
These were fixed in the current version.

## Downstream dependencies

- There are currently no downstream dependencies for this package
File renamed without changes
File renamed without changes
File renamed without changes
Binary file removed images/unnamed-chunk-6-1.png
Binary file not shown.
Binary file modified images/unnamed-chunk-7-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 10ac991

Please sign in to comment.