-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
library(BayesianReasoning)
library(ggplot2)
library(dplyr)
library(patchwork)
p1 = BayesianReasoning::PPV_heatmap(
min_Prevalence = 1, max_Prevalence = 1000,
Sensitivity = 90, limits_Specificity = c(90, 100),
overlay = "area",
overlay_prevalence_1 = 1, overlay_prevalence_2 = 100,
overlay_position_FP = 2, overlay_extra_info = TRUE)
counts <- c(1.98, 97.02, 0.9, 0.1)
color_fill <- c("#453781ff", "#238a8dff", "#238a8dff", "#453781ff")
gender <- gl(n = 2, k = 1, length = 4, labels = c("+", "-"))
interest <- gl(n = 2, k = 2, length = 4, labels = c("Healthy", "Sick"))
survey_data <- data.frame(counts, gender, interest, color_fill)
p2 = ggplot(data = survey_data, aes(x = interest, y = gender)) +
geom_tile(aes(fill = color_fill)) +
geom_text(aes(label = counts), color = "black", size = 5) +
scale_x_discrete(expand = c(0,0)) +
scale_y_discrete(expand = c(0,0)) +
scale_fill_identity() +
theme_minimal(base_size = 14) +
coord_fixed(ratio = 1) +
labs(x = "", y = "") +
theme(legend.position = "none",
# plot.background = element_rect(fill = 'white', colour = 'black'),
plot.margin=grid::unit(c(0,0,0,0), "mm"),
axis.text.x = element_text(colour = "black"),
axis.text.y = element_text(colour = "black")
)
p1 + inset_element(p2, left = 0.8, bottom = 0, right = 1, top = .2, clip = TRUE)
