Skip to content

Commit

Permalink
reduced examples, updated README, related to #47
Browse files Browse the repository at this point in the history
  • Loading branch information
m-jahn committed Jan 8, 2024
1 parent be5fd74 commit 5ead5dc
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 107 deletions.
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
2 changes: 1 addition & 1 deletion 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 Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
WeightedTreemaps
================
Michael Jahn, David Leslie, Ahmadou Dicko
2023-12-15
Michael Jahn, David Leslie, Ahmadou Dicko, Paul Murrell
2024-01-07

<!-- include logo-->

Expand Down
7 changes: 5 additions & 2 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Release
## Update

## Test environments

Expand All @@ -10,13 +10,13 @@
- 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

Expand All @@ -34,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
53 changes: 28 additions & 25 deletions man/drawTreemap.Rd

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

53 changes: 26 additions & 27 deletions man/voronoiTreemap.Rd

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

0 comments on commit 5ead5dc

Please sign in to comment.