Package 'OrigamiPlot'

Title: A Visualization Tool Enhancing Radar Plot Visualizations for Multivariate Data
Description: A visualization tool for multivariate data. This package maintains the original functionality of a radar chart and avoids potential misuse of its connected regions, with newly added features to better assist multi-criteria decision-making.
Authors: Yiwen Lu [aut, cre], Jiayi Tong [aut], Yuqing Lei [aut], Alex Sutton [aut], Haitao Chu [aut], Lisa Levine [aut], Thomas Lumley [aut], David Asch [aut], Rui Duan [aut], Christopher Schmid [aut], Yong Chen [aut]
Maintainer: Yiwen Lu <[email protected]>
License: GPL (>= 2)
Version: 0.2.0
Built: 2024-11-13 03:42:45 UTC
Source: https://github.com/cran/OrigamiPlot

Help Index


Function to calculate area of the generated polygon

Description

Function to calculate area of the generated polygon

Usage

area_calculation(df)

Arguments

df

input dataframe in the required format

Details

This function serves as a supplementary tool to compute the area of each generated origami plot when the maximal area achievable within the defined parameters (when all the variables attain 1) is set to 1. The resulting calculated area offers an interpretation of the proportion between the actual origami plot and the maximum achievable area.

Value

result

Examples

data(sucra)
area_calculation(sucra)

Function to prepare the data into designated format

Description

Function to prepare the data into designated format

Usage

data_preparation(df, min_value = NULL)

Arguments

df

dataset with each column representing a variable name paired with its value and each row representing a graph

min_value

auxiliary point in the graph, default is min(df)/2

Details

This function takes a single-row dataframe as input and output a formatted dataframe. It introduces an auxiliary point for each variable, positioned equidistantly from the central point along auxiliary axes. Users can customize the distance from the point to the center. Without user customization, the distance defaults to half of the smallest value within the dataset.

Value

df

Examples

data(sucra)
data_preparation(sucra,min_value=0.15)

Function to generate origami plot

Description

Function to generate origami plot

Usage

origami_plot(
  df,
  object,
  min_value = NULL,
  pcol = rgb(0.2, 0.5, 0.5, 1),
  pfcol = rgb(0.2, 0.5, 0.5, 0.1),
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object

the name of the row that user wants to plot

min_value

auxiliary point in the graph, default is min(df)/2

pcol

color of the line of the polygon, default is rgb(0.2,0.5,0.5,1).

pfcol

color to fill the area of the polygon, default is rgb(0.2,0.5,0.5,0.1).

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This is the main function in the R package that takes a list of data frame(s) and constructs an origami plot. The function plots the main axes of the radar chart as solid lines and marks the score of each variable on these axes with a filled circle. Additionally, it plots auxiliary axes as dashed lines at equal distances between each neighboring pair of primary axes with auxiliary points generated from data_preparation. Finally, the function connects all the points in order and obtain a connected region that resembles an origami star. Through this method, we successfully address the challenge of axis order affecting the area of the connected region in radar plots. The plot generated using ‘origami_plot’ benefit in that the area of the connected region within the origami plot remains consistent regardless of axis sequence.

Value

No return value, called for visualization

Examples

data(sucra)
origami_plot(sucra, object="Intravertical PGE2")

Function to generate pairwise origami plot

Description

Function to generate pairwise origami plot

Usage

origami_plot_pairwise(
  df,
  object1,
  object2,
  min_value = NULL,
  pcol1 = rgb(0.2, 0.5, 0.5, 1),
  pfcol1 = rgb(0.2, 0.5, 0.5, 0.1),
  pcol2 = rgb(0.6, 0.3, 0.3, 1),
  pfcol2 = rgb(0.6, 0.3, 0.3, 0.1),
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object1

the name of the first row that user wants to plot

object2

the name of the second row that user wants to plot

min_value

auxiliary point in the graph, default is min(df)/2

pcol1

color of the line of the first polygon, default is rgb(0.2,0.5,0.5,1)

pfcol1

color to fill the area of the first polygon, default is rgb(0.2,0.5,0.5,0.1).

pcol2

color of the line of the second polygon, rgb(0.6,0.3,0.3,1)

pfcol2

color to fill the area of the second polygon, default is rgb(0.6,0.3,0.3,0.1).

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This function is an adaptation of the original origami_plot function, designed to visualize two datasets within a single graph. Pairwise origami plots can serve as a potent tool for conducting comparisons across various levels, offering unique insights into the data being analyzed

Value

No return value, called for visualization

Examples

data(sucra)
origami_plot_pairwise(sucra, object1="Intravertical PGE2", object2="High-dose oral misoprostol")

Function to generate weighted origami plot

Description

Function to generate weighted origami plot

Usage

origami_plot_weighted(
  df,
  object,
  weight,
  min_value = NULL,
  pcol = rgb(0.2, 0.5, 0.5, 1),
  pfcol = rgb(0.2, 0.5, 0.5, 0.1),
  pcol2 = rgb(0.6, 0.3, 0.3, 1),
  pfcol2 = NULL,
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object

the name of the row that user wants to plot

weight

weight of each variable, sum up to 1

min_value

auxiliary point in the graph, default is min(df)/2

pcol

color of the line of the original polygon, default is rgb(0.2,0.5,0.5,1)

pfcol

color to fill the area of the original polygon, default is rgb(0.2,0.5,0.5,0.1).

pcol2

color of the line of the weighted polygon, default is rgb(0.6,0.3,0.3,1).

pfcol2

color to fill the area of the weighted polygon, default is NULL.

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This function allows the creation of an origami plot with user-specified weights for different outcomes. The weighted origami plot is a refined analytical tool that facilitates the adjustment of individual attribute weights to accurately reflect their significance in determining overall performance. For instance, if certain outcomes hold greater clinical relevance based on a scientific question, the user can assign higher weights to these outcomes relative to others. Note that the weights assigned should sum up to 1.

Value

No return value, called for visualization

Examples

data(sucra)
origami_plot_weighted(sucra, object="Intravertical PGE2", weight = c(0.15,0.25,0.3,0.2,0.1))

Function to generate origami plot

Description

Function to generate origami plot

Usage

snowflake_plot(
  df,
  object,
  min_value = NULL,
  pcol = rgb(0.2, 0.5, 0.5, 1),
  pfcol = rgb(0.2, 0.5, 0.5, 0.1),
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object

the name of the row that user wants to plot

min_value

auxiliary point in the graph, default is min(df)/2

pcol

color of the line of the polygon, default is rgb(0.2,0.5,0.5,1).

pfcol

color to fill the area of the polygon, default is rgb(0.2,0.5,0.5,0.1).

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This is an alias version of the function origami_plot.

Value

No return value, called for visualization

Examples

data(sucra)
snowflake_plot(sucra, object="Intravertical PGE2")

Function to generate pairwise origami plot

Description

Function to generate pairwise origami plot

Usage

snowflake_plot_pairwise(
  df,
  object1,
  object2,
  min_value = NULL,
  pcol1 = rgb(0.2, 0.5, 0.5, 1),
  pfcol1 = rgb(0.2, 0.5, 0.5, 0.1),
  pcol2 = rgb(0.6, 0.3, 0.3, 1),
  pfcol2 = rgb(0.6, 0.3, 0.3, 0.1),
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object1

the name of the first row that user wants to plot

object2

the name of the second row that user wants to plot

min_value

auxiliary point in the graph, default is min(df)/2

pcol1

color of the line of the first polygon, default is rgb(0.2,0.5,0.5,1)

pfcol1

color to fill the area of the first polygon, default is rgb(0.2,0.5,0.5,0.1).

pcol2

color of the line of the second polygon, rgb(0.6,0.3,0.3,1)

pfcol2

color to fill the area of the second polygon, default is rgb(0.6,0.3,0.3,0.1).

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This function is an alias version of function origami_plot_pairwise

Value

No return value, called for visualization

Examples

data(sucra)
snowflake_plot_pairwise(sucra, object1="Intravertical PGE2", object2="High-dose oral misoprostol")

Function to generate weighted origami plot

Description

Function to generate weighted origami plot

Usage

snowflake_plot_weighted(
  df,
  object,
  weight,
  min_value = NULL,
  pcol = rgb(0.2, 0.5, 0.5, 1),
  pfcol = rgb(0.2, 0.5, 0.5, 0.1),
  pcol2 = rgb(0.6, 0.3, 0.3, 1),
  pfcol2 = NULL,
  axistype = 1,
  seg = 4,
  pty = 16,
  plty = 1:6,
  plwd = 1,
  pdensity = NULL,
  pangle = 45,
  cglty = 1.4,
  cglwd = 0.1,
  cglcol = "#000000",
  axislabcol = "#808080",
  title = "",
  na.itp = TRUE,
  centerzero = TRUE,
  vlabels = NULL,
  vlcex = 1,
  caxislabels = seq(0, 1, by = 0.25),
  calcex = NULL,
  paxislabels = NULL,
  palcex = NULL
)

Arguments

df

input dataframe in the required format

object

the name of the row that user wants to plot

weight

weight of each variable, sum up to 1

min_value

auxiliary point in the graph, default is min(df)/2

pcol

color of the line of the original polygon, default is rgb(0.2,0.5,0.5,1)

pfcol

color to fill the area of the original polygon, default is rgb(0.2,0.5,0.5,0.1).

pcol2

color of the line of the weighted polygon, default is rgb(0.6,0.3,0.3,1).

pfcol2

color to fill the area of the weighted polygon, default is NULL.

axistype

type of axes. 0:no axis label. 1:center axis label only. 2:around-the-chart label only. 3:both center and around-the-chart labels. Default is 1.

seg

number of segments for each axis, default is 4.

pty

point symbol, default is 16. 32 means not printing the points.

plty

line types for plot data, default is 1:6

plwd

line widths for plot data, default is 1

pdensity

filling density of polygons, default is NULL

pangle

angles of lines used as filling polygons, default is 45

cglty

line type for radar grids, default is 1.4

cglwd

line width for radar grids, default is 0.1

cglcol

line color for radar grids, default is #000000

axislabcol

color of axis label and numbers, default is #808080

title

title of the chart, default is blank

na.itp

logical. If true, items with NA values are interpolated from nearest neighbor items and connect them. If false, items with NA are treated as the origin. Default is TRUE.

centerzero

logical. If true, this function draws charts with scaling originated from (0,0). If false, charts originated from (1/segments). Default is TRUE.

vlabels

character vector for the names for variables, default is NULL

vlcex

font size magnification for vlabels, default is 1

caxislabels

center axis labels, default is seq(0,1,by = 0.25)

calcex

font size magnification for caxislabels, default is NULL

paxislabels

around-the-chart labels, default is NULL

palcex

font size magnification for paxislabels, default is NULL

Details

This is the alias version of origami_plot_weighted function.

Value

No return value, called for visualization

Examples

data(sucra)
snowflake_plot_weighted(sucra, object="Intravertical PGE2", weight = c(0.15,0.25,0.3,0.2,0.1))

SUCRA

Description

A dataset containing example data.

Usage

sucra

Format

A data frame with 8 rows and 5 variables:

caesarean

Caesarean section

maternal

Serious maternal morbidity or death

neonatal

Serious neonatal morbidity or perinatal death

hyperstimulation

Hyperstimulation

vaginal

Vaginal delivery not within 24 hours