Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

#219 add facet_scales to plot aesthetics menu #227

Merged
merged 7 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#' label of `x-axis` tick values. Default value is `waive()`.
#' @param rotate_xlab `logical(1)` value indicating whether to rotate `x-axis` labels
#' @param facet_ncol numeric value indicating number of facets per row.
#' @param free_x `logical(1)` should scales be `"fixed"` (`FALSE`) of `"free"` (`TRUE`) for `x-axis` in
#' \code{\link[ggplot2]{facet_wrap}} \code{scales} parameter.
#' @param plot_height controls plot height.
#' @param plot_width optional, controls plot width.
#' @param font_size control font size for title, `x-axis`, `y-axis` and legend font.
Expand Down Expand Up @@ -213,6 +215,7 @@ tm_g_gh_spaghettiplot <- function(label,
xlabel = xtick,
rotate_xlab = FALSE,
facet_ncol = 2,
free_x = FALSE,
plot_height = c(600, 200, 2000),
plot_width = NULL,
font_size = c(12, 8, 20),
Expand All @@ -238,6 +241,7 @@ tm_g_gh_spaghettiplot <- function(label,
lower = plot_width[2], upper = plot_width[3], null.ok = TRUE,
.var.name = "plot_width"
)
checkmate::assert_flag(free_x)

args <- as.list(environment())

Expand Down Expand Up @@ -334,6 +338,7 @@ g_ui_spaghettiplot <- function(id, ...) {
)
)
),
checkboxInput(ns("free_x"), "Free X-Axis Scales", a$free_x),
checkboxInput(ns("rotate_xlab"), "Rotate X-Axis Label", a$rotate_xlab),
teal.widgets::optionalSliderInputValMinMax(ns("font_size"), "Font Size", a$font_size, ticks = FALSE),
teal.widgets::optionalSliderInputValMinMax(
Expand Down Expand Up @@ -418,6 +423,7 @@ srv_g_spaghettiplot <- function(id,
# nolint start
ylim <- yrange_slider$state()$value
facet_ncol <- input$facet_ncol
facet_scales <- ifelse(input$free_x, "free_x", "fixed")

rotate_xlab <- input$rotate_xlab
hline_arb <- horizontal_line()$line_arb
Expand Down Expand Up @@ -482,6 +488,7 @@ srv_g_spaghettiplot <- function(id,
color_comb = .(color_comb),
ylim = .(ylim),
facet_ncol = .(facet_ncol),
facet_scales = .(facet_scales),
hline_arb = .(hline_arb),
hline_arb_label = .(hline_arb_label),
hline_arb_color = .(hline_arb_color),
Expand Down
4 changes: 4 additions & 0 deletions man/tm_g_gh_spaghettiplot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.