geom_sii_risksurface {ggsolvencyii} | R Documentation |
geom_sii_risksurface
Description
returns a 'ggplot2' object, based on geom_polygon, with filled, concentric circle(part)s, defined by the values in a hierarchy of levels.
Usage
geom_sii_risksurface(data = NULL, mapping = NULL,
stat = "sii_risksurface",
structure = ggsolvencyii::sii_structure_sf16_eng, squared = FALSE,
levelmax = 99, aggregatesuffix = "_other", plotdetails = NULL,
rotationdegrees = NULL, rotationdescription = NULL,
maxscrvalue = NULL, scalingx = 1, scalingy = 1,
position = "identity", na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE, ...)
Arguments
data |
the dataset in tidyverse format (column 'description' as a factor). see examples in |
mapping |
required aes(thetics) : x (i.e. time, longitude), y (i.e SCR ratio, lattitude), id, description (), value |
stat |
default stat is statsii_risksurface, combinations with other stat's are not tested |
structure |
(dataframe: default =
. In the standard formula structure, SCR has level 1, with childlevel 2. This means it consists of all datalines with level == 2, ie. "BSCR", "operational" and "Adjustment-LACDT". lines in the dataset with a suffix "d" behind the levelnumber are diversification items. As of now these are not used in any calculation. the values in column "description" in the dataset need to match the description in this file. The package contains also a file |
squared |
(optional, boolean, default = FALSE) |
levelmax |
(integer or dataframe, default = 99) |
aggregatesuffix |
(string, default = "_other") |
plotdetails |
(optional) a table with columns 'levelordescription' and 'surface', indicating which circle elements to plot. When no table is provided all segments are plotted. example 3 shows how to combine geom_sii_risksurface and geom_sii_riskoutline by using using table |
rotationdegrees |
(optional, integer, -360 to 360, default = NULL) |
rotationdescription |
(optional, string, default = NULL) |
maxscrvalue |
(optional, double, default = NULL) |
scalingx |
(optional, positive value ,default = 1) |
scalingy |
(optional, positive value ,default = 1) |
position |
standard ggplot function |
na.rm |
standard ggplot function |
show.legend |
standard ggplot function |
inherit.aes |
standard ggplot function |
... |
ellipsis, a standard R parameter |
Value
a ggplot object
Examples
## dataset human readable
library(ggsolvencyii)
library(ggplot2)
t <- tidyr::spread(data = sii_z_ex1_data, key = description, value = value)
t <- as.data.frame(t)
t <- t[order(t$id),]
t <- dplyr::select( t, id, time, comparewithid, ratio, SCR, dplyr::everything())
t[1:3 ,1:8]
ggplot() +
geom_sii_risksurface(
data = sii_z_ex1_data[sii_z_ex1_data$id == 1, ],
mapping = aes(x = time,
y = ratio,
id = id,
value = value,
description = description,
color = description,
fill = description
) ) +
theme_bw() +
scale_fill_manual(name = "Risks",values = sii_x_fillcolors_sf16_eng) +
scale_color_manual(name = "Risks",values = sii_x_edgecolors_sf16_eng)
ggplot() +
geom_sii_risksurface(
data = sii_z_ex2_data,
mapping = aes(x = time, y = ratio, id = id, value = value,
description = description,
# color = description,
fill = description
),
color = "black",
levelmax = sii_levelmax_sf16_993) +
theme_bw() +
scale_fill_manual(name = "Risks",values = sii_x_fillcolors_sf16_eng) # +
# scale_color_manual(name = "Risks",values = sii_x_edgecolors_sf16_eng)
ggplot() +
geom_sii_risksurface(data = sii_z_ex1_data[sii_z_ex1_data$id == 1, ],
mapping = ggplot2::aes(x = time,
y = ratio,
## x and y could for example be
## longitude and latitude
## in combination with plotted map
value = value,
id = id,
description = description,
fill = description, ## optional
color = description ## optional
),
## all parameters are shown here,
## the values behind the outcommented are the default values
## how and what
## structure = sii_structure_sf16_eng,
## plotdetails = NULL,
## grouping
# levelmax = 99,
# aggregatesuffix = "other",
## scaling
# maxscrvalue = NULL,
# scalingx = 1,
# scalingy = 1,
## rotation and squared
# rotationdegrees = NULL,
# rotationdescription = NULL,
# squared = FALSE,
## cosmetic
lwd = 0.25,
# alpha = 1
) +
theme_bw() +
scale_fill_manual(name = "risks", values = sii_z_ex1_fillcolors) +
scale_color_manual(name = "risks", values = sii_z_ex1_edgecolors)