circlesplot(): Plots multiple circles with their given ratios
Source:R/circlesplot.R
circlesplot.Rd
`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
# \donttest{
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")
#> Loading required package: viridisLite
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))