feat: new distribution plotting for categorical (incl dichotomous) variables

This commit is contained in:
Andreas Gammelgaard Damsbo 2025-10-31 11:39:12 +01:00
commit ae9aa2e6f5
No known key found for this signature in database
4 changed files with 174 additions and 6 deletions

View file

@ -1,11 +1,13 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/data_plots.R, R/plot_box.R, R/plot_hbar.R,
% R/plot_ridge.R, R/plot_sankey.R, R/plot_scatter.R, R/plot_violin.R
% Please edit documentation in R/data_plots.R, R/plot_bar.R, R/plot_box.R,
% R/plot_hbar.R, R/plot_ridge.R, R/plot_sankey.R, R/plot_scatter.R,
% R/plot_violin.R
\name{data-plots}
\alias{data-plots}
\alias{data_visuals_ui}
\alias{data_visuals_server}
\alias{create_plot}
\alias{plot_bar_single}
\alias{plot_box}
\alias{plot_box_single}
\alias{plot_hbars}
@ -22,6 +24,14 @@ data_visuals_server(id, data, ...)
create_plot(data, type, pri, sec, ter = NULL, ...)
plot_bar_single(
data,
pri,
sec = NULL,
style = c("stack", "dodge", "fill"),
max_level = 30
)
plot_box(data, pri, sec, ter = NULL, ...)
plot_box_single(data, pri, sec = NULL, seed = 2103)
@ -60,6 +70,9 @@ plot_violin(data, pri, sec, ter = NULL)
\item{sec}{secondary variable}
\item{ter}{tertiary variable}
\item{style}{barplot style passed to geom_bar position argument.
One of c("stack", "dodge", "fill")}
}
\value{
Shiny ui module
@ -68,6 +81,8 @@ shiny server module
ggplot2 object
ggplot object
ggplot2 object
ggplot object
@ -89,6 +104,8 @@ Data correlations evaluation module
Wrapper to create plot based on provided type
Single vertical barplot
Beautiful box plot(s)
Create nice box-plots
@ -107,6 +124,13 @@ Beatiful violin plot
}
\examples{
create_plot(mtcars, "plot_violin", "mpg", "cyl") |> attributes()
mtcars |>
dplyr::mutate(cyl = factor(cyl), am = factor(am)) |>
plot_bar_single(pri = "cyl", sec = "am", style = "fill")
mtcars |>
dplyr::mutate(cyl = factor(cyl), am = factor(am)) |>
plot_bar_single(pri = "cyl", style = "stack")
mtcars |> plot_box(pri = "mpg", sec = "gear")
mtcars |> plot_box(pri = "mpg", sec="cyl")
mtcars |>