Type: | Package |
Title: | Visualize Proportions with Circles in a Plot |
Version: | 1.1.0 |
Description: | Method for visualizing proportions between objects of different sizes. The proportions are drawn as circles with different diameters, which makes them ideal for visualizing proportions between planets. |
License: | MIT + file LICENSE |
Imports: | plotrix |
Suggests: | knitr, rmarkdown, testthat (≥ 3.0.0), viridis |
URL: | https://github.com/BenSt099/circlesplot, https://benst099.github.io/circlesplot/ |
BugReports: | https://github.com/BenSt099/circlesplot/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.1 |
Config/testthat/edition: | 3 |
VignetteBuilder: | knitr |
NeedsCompilation: | no |
Packaged: | 2024-02-19 18:56:18 UTC; PC |
Author: | BenSt099 [aut, cre, cph] |
Maintainer: | BenSt099 <benst099@proton.me> |
Repository: | CRAN |
Date/Publication: | 2024-02-20 10:10:02 UTC |
circlesplot(): Plots multiple circles with their given ratios
Description
'circlesplot()' plots circles with a given diameter next to each other, so readers can observe the ratio between them.
Usage
circlesplot(
cp_vals = NULL,
cp_text = NULL,
cp_max = 10L,
cp_line_width = 2L,
cp_title = "",
cp_color = NULL,
cp_title_size = 1.5,
cp_sort = "none",
cp_tight_spacing = 1,
cp_shape = "circle"
)
Arguments
cp_vals |
Vector (numeric); provides data |
cp_text |
Vector (characters); provides text-labels |
cp_max |
Maximum number of circles in a row (integer) |
cp_line_width |
Line-width of the circles (integer) |
cp_title |
Title of the plot (String) |
cp_color |
Vector of hex-colors for each circle |
cp_title_size |
Size of the title (numeric or integer) |
cp_sort |
String; specifies if values should be sorted ('asc', 'desc'; default: 'none') |
cp_tight_spacing |
Number (numeric); specifies spacing between rows (default: 1.0, possible: 1.0 - 2.0; 2.0 smallest distance) |
cp_shape |
String; specifies the shape (default: 'circle'; possible: 'square') |
Value
Returns object of class 'recordedPlot'. Can be used for saving the plot to a variable and replay it again (See https://benst099.github.io/circlesplot/articles/cp_vignette.html).
Examples
library('plotrix')
colors = c('#D1BBD7', '#AE76A3', '#882E72', '#1965B0', '#5289C7', '#7BAFDE', '#4EB265', '#90C987')
values = c(5,5,4,5,5,5,2,1)
text = c('8','7','6','5','4','3','2','1')
circlesplot(cp_vals=values, cp_text=text, cp_max=3L, cp_title="Some title", cp_color=colors)
# Proportions among planets
library('plotrix')
colors = c('#D1BBD7', '#AE76A3', '#882E72', '#1965B0', '#5289C7', '#7BAFDE', '#4EB265', '#90C987')
planets = c('Mercury','Venus','Earth','Mars','Jupiter','Saturn','Uranus','Neptune')
diameter = c(4879.4,12103.6,12756.3,6792.4,142984,120536,51118,49528)
circlesplot(cp_vals=diameter, cp_text=planets, cp_max=3L, cp_title="Planets", cp_color=colors)
# For coloring, you can also use viridis package:
library("viridis")
values = c(5,5,4,5,5,5,2,1)
text = c('8','7','6','5','4','3','2','1')
circlesplot(cp_vals=values, cp_text=text, cp_max=4L, cp_title="Some title", cp_color=viridis(8))