tm_g_bivariate {teal.modules.general} | R Documentation |
teal
module: Univariate and bivariate visualizations
Description
Module enables the creation of univariate and bivariate plots, facilitating the exploration of data distributions and relationships between two variables.
Usage
tm_g_bivariate(
label = "Bivariate Plots",
x,
y,
row_facet = NULL,
col_facet = NULL,
facet = !is.null(row_facet) || !is.null(col_facet),
color = NULL,
fill = NULL,
size = NULL,
use_density = FALSE,
color_settings = FALSE,
free_x_scales = FALSE,
free_y_scales = FALSE,
plot_height = c(600, 200, 2000),
plot_width = NULL,
rotate_xaxis_labels = FALSE,
swap_axes = FALSE,
ggtheme = c("gray", "bw", "linedraw", "light", "dark", "minimal", "classic", "void"),
ggplot2_args = teal.widgets::ggplot2_args(),
pre_output = NULL,
post_output = NULL
)
Arguments
label |
( |
x |
( |
y |
( |
row_facet |
( |
col_facet |
( |
facet |
( |
color |
( |
fill |
( |
size |
( |
use_density |
( |
color_settings |
( |
free_x_scales |
( |
free_y_scales |
( |
plot_height |
( |
plot_width |
( |
rotate_xaxis_labels |
( |
swap_axes |
( |
ggtheme |
( |
ggplot2_args |
( For more details see the vignette: |
pre_output |
( |
post_output |
( |
Details
This is a general module to visualize 1 & 2 dimensional data.
Value
Object of class teal_module
to be used in teal
applications.
Note
For more examples, please see the vignette "Using bivariate plot" via
vignette("using-bivariate-plot", package = "teal.modules.general")
.
Examples
library(teal.widgets)
# general data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
CO2 <- data.frame(CO2)
})
datanames(data) <- c("CO2")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(
tm_g_bivariate(
x = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]]),
selected = "conc",
fixed = FALSE
)
),
y = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]]),
selected = "uptake",
multiple = FALSE,
fixed = FALSE
)
),
row_facet = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]]),
selected = "Type",
fixed = FALSE
)
),
col_facet = data_extract_spec(
dataname = "CO2",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["CO2"]]),
selected = "Treatment",
fixed = FALSE
)
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Bivariate Module")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}
# CDISC data example
data <- teal_data()
data <- within(data, {
require(nestcolor)
ADSL <- rADSL
})
datanames(data) <- c("ADSL")
join_keys(data) <- default_cdisc_join_keys[datanames(data)]
app <- init(
data = data,
modules = modules(
tm_g_bivariate(
x = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]]),
selected = "AGE",
fixed = FALSE
)
),
y = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]]),
selected = "SEX",
multiple = FALSE,
fixed = FALSE
)
),
row_facet = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]]),
selected = "ARM",
fixed = FALSE
)
),
col_facet = data_extract_spec(
dataname = "ADSL",
select = select_spec(
label = "Select variable:",
choices = variable_choices(data[["ADSL"]]),
selected = "COUNTRY",
fixed = FALSE
)
),
ggplot2_args = ggplot2_args(
labs = list(subtitle = "Plot generated by Bivariate Module")
)
)
)
)
if (interactive()) {
shinyApp(app$ui, app$server)
}