This function generates a bubble plot to visualize the results of the PCI calculation. It shows the mean action acceptability on the y-axis and the PCI value as the size of the bubbles.
Create a bubble plot to visualize PCI results. This function generates a bubble plot where each bubble represents a group. The size of the bubble corresponds to the PCI value, and the y-axis shows the mean action acceptability for each group.
Usage
bubble(
df3,
scale_type = c("bipolar", "unipolar"),
ylim_range = 4,
unipolar_ylim = c(1, 9),
xlab = "",
ylab = "Action acceptability",
title = NULL,
bubble_color = "gray80",
bubble_stroke = "black"
)
bubble(
df3,
scale_type = c("bipolar", "unipolar"),
ylim_range = 4,
unipolar_ylim = c(1, 9),
xlab = "",
ylab = "Action acceptability",
title = NULL,
bubble_color = "gray80",
bubble_stroke = "black"
)
Arguments
- df3
A data frame generated by the
pci
function, containing the PCI values and other statistics.- scale_type
The scale type used for the plot: 'bipolar' or 'unipolar'. Default is 'bipolar'.
- ylim_range
For 'bipolar' scale, the range of the y-axis. Must be an integer between 1 and 4.
- unipolar_ylim
A numeric vector of length 2 specifying the y-axis limits for 'unipolar' scale.
- xlab
The label for the x-axis. Default is an empty string.
- ylab
The label for the y-axis. Default is 'Action acceptability'.
- title
Optional title for the plot. Default is NULL.
- bubble_color
The fill color of the bubbles. Default is 'gray80'.
- bubble_stroke
The border color of the bubbles. Default is 'black'.
Details
The bubble plot displays the 'Mean' value on the y-axis and the PCI value as the size of the bubbles. It helps to visualize the relationship between action acceptability (mean score) and the potential for conflict index (PCI) for each category in the dataset.
Examples
data <- data.frame(
Category = rep(c('A', 'B', 'C'), each = 3),
Value = c(-1, 0, 1, -1, 0, 1, -1, 0, 1)
)
df2 <- counting(data)
#> Error in dplyr::select(., all_of(cols)): ℹ In argument: `all_of(cols)`.
#> Caused by error:
#> ! argument "cols" is missing, with no default
df3 <- pci(df2)
#> Error: object 'df2' not found
bubble(df3)
#> Error: object 'df3' not found
df3 <- pci(df2)
#> Error: object 'df2' not found
bubble(df3)
#> Error: object 'df3' not found