From 0ef9c448fc7b51ccb605deb7849b8d19fd8e4967 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Thu, 29 Feb 2024 11:22:54 +0100 Subject: [PATCH 1/8] add yaxis custom settings --- R/mod_boxplots.R | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index 78d6a9b..8c19dc9 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -64,7 +64,10 @@ mod_boxplots_ui <- function(id){ materialSwitch(ns("ggplotstats1"), label = "Display ggstatsplot", value = TRUE, status = "primary"), materialSwitch(ns("plotall"), label = "Plot all conditions (even NAs)", value = TRUE, status = "primary"), materialSwitch(ns("grey_mode"), label = "Colored boxplot", value = TRUE, status = "primary"), - materialSwitch(ns("y0"), label = "Set y lower limit to 0", value = TRUE, status = "primary"), + materialSwitch(ns("ySci"), label = "Yaxis scientific numbers:", value = TRUE, status = "primary"), + numericInput(ns("ymin"), "Y min:", 0), + numericInput(ns("ymax"), "Y max:", NA), + numericInput(ns("ysteps"), "Y steps:", NA), width = 6 ), column( @@ -294,8 +297,13 @@ mod_boxplots_server <- function(id, r = r, session = session){ labs(fill="")') eval(parse(text=fun)) - if(input$y0){ - p <- p + coord_cartesian(ylim = c(0, NA )) + + if(is.na(input$ysteps)){ + # Y custom + p <- p + coord_cartesian(ylim = c(input$ymin, input$ymax)) + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) + }else{ + p <- p + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), + labels = function(x) format(x, scientific = input$ySci)) } if(!input$grey_mode){ @@ -320,14 +328,11 @@ mod_boxplots_server <- function(id, r = r, session = session){ fun <- glue::glue(' ggstats <- ggbetweenstats(tabfeat, {r_values$fact3ok}, value, type = "nonparametric", p.adjust.method = "fdr", pairwise.display = "significant", xlab = "", ylab = ytitle, - outlier.tagging = TRUE, outlier.label = "sample.id", results.subtitle = FALSE, title = input$feat1) + outlier.tagging = TRUE, outlier.label = "sample.id", results.subtitle = FALSE, title = input$feat1) + + coord_cartesian(ylim = c(0, NA)) ') eval(parse(text=fun)) - if(input$y0){ - ggstats <- ggstats + coord_cartesian(ylim = c(0, NA)) - } - r_values$ggstats <- ggstats outlist$ggstats <- ggstats } -- GitLab From 693bc45a1e44f8e2d491902b2f57c89455d3e3ad Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Thu, 29 Feb 2024 12:05:03 +0100 Subject: [PATCH 2/8] update --- R/mod_boxplots.R | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index 8c19dc9..78df188 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -298,14 +298,16 @@ mod_boxplots_server <- function(id, r = r, session = session){ eval(parse(text=fun)) - if(is.na(input$ysteps)){ # Y custom - p <- p + coord_cartesian(ylim = c(input$ymin, input$ymax)) + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) - }else{ + p <- p + coord_cartesian(ylim = c(input$ymin, input$ymax)) + + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) + + if(!is.na(input$ysteps)){ p <- p + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), labels = function(x) format(x, scientific = input$ySci)) } + if(!input$grey_mode){ p <- p + geom_boxplot(fill = "grey") @@ -450,9 +452,14 @@ mod_boxplots_server <- function(id, r = r, session = session){ labs(fill="")') eval(parse(text=fun)) - if(input$y0){ - listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(0, NA )) - } + # Y custom + listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(input$ymin, input$ymax)) + + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) + + if(!is.na(input$ysteps)){ + listP[[FEAT[i]]] <- listP[[FEAT[i]]] + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), + labels = function(x) format(x, scientific = input$ySci)) + } if(input$outlier_labs){ listP[[FEAT[i]]] <- listP[[FEAT[i]]] + @@ -550,14 +557,11 @@ mod_boxplots_server <- function(id, r = r, session = session){ fun <- glue::glue(' listP[[FEAT[i]]] <- ggbetweenstats(tabfeat, {r_values$fact3ok}, value, type = "nonparametric", p.adjust.method = "fdr", pairwise.display = "significant", xlab = "", ylab = ytitle, - outlier.tagging = TRUE, outlier.label = "sample.id", title = FEAT[i], results.subtitle = FALSE)') + outlier.tagging = TRUE, outlier.label = "sample.id", title = FEAT[i], results.subtitle = FALSE) + + coord_cartesian(ylim = c(0, NA))') eval(parse(text=fun)) - if(input$y0){ - listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(0, NA)) - } - # print("WRITE PLOTS") # dir.create(paste(tmpdir, "/figures_ggstat/", sep = ""), recursive = TRUE) # print(paste(tmpdir, "/figures_ggstat/", sep = "")) -- GitLab From 29dbf60e4710bfb0b52aaede492e7abee7b6e278 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Thu, 29 Feb 2024 15:07:00 +0100 Subject: [PATCH 3/8] yaxis ggplot ok --- R/mod_boxplots.R | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index 78df188..edbea03 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -60,10 +60,11 @@ mod_boxplots_ui <- function(id){ column( h3("General settings"), - textInput(ns("custom_ytitle"), "Custom y title", "None"), materialSwitch(ns("ggplotstats1"), label = "Display ggstatsplot", value = TRUE, status = "primary"), materialSwitch(ns("plotall"), label = "Plot all conditions (even NAs)", value = TRUE, status = "primary"), materialSwitch(ns("grey_mode"), label = "Colored boxplot", value = TRUE, status = "primary"), + h3("Y axis settings"), + textInput(ns("custom_ytitle"), "Custom y title", "None"), materialSwitch(ns("ySci"), label = "Yaxis scientific numbers:", value = TRUE, status = "primary"), numericInput(ns("ymin"), "Y min:", 0), numericInput(ns("ymax"), "Y max:", NA), @@ -182,11 +183,14 @@ mod_boxplots_server <- function(id, r = r, session = session){ ) ) + updateNumericInput(session, "ymax", label = glue::glue("Ymax: (max value in dataset: {format(max(r_values$subsetds_final_melt$value, na.rm = TRUE), scientific = TRUE, digits = 2)})"), + value = NA ) + } }) - boxtab <- eventReactive(c(input$go4, input$go3), { # + boxtab <- reactive({ cat(file=stderr(), 'BOXTAB', "\n") req(r_values$subsetds_final_melt, input$fact3, r$ds1()) r_values$tabF_melt2 <- tabF_melt2 <- tabF_melt <- r_values$subsetds_final_melt @@ -302,11 +306,19 @@ mod_boxplots_server <- function(id, r = r, session = session){ p <- p + coord_cartesian(ylim = c(input$ymin, input$ymax)) + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) - if(!is.na(input$ysteps)){ + if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ + print("ycustom1") p <- p + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), labels = function(x) format(x, scientific = input$ySci)) } + if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ + print("ycustom2") + p <- p + coord_cartesian(ylim = c(0, max(tabfeat$value, na.rm = TRUE))) + + scale_y_continuous(breaks = seq(0, max(tabfeat$value, na.rm = TRUE), input$ysteps), + labels = function(x) format(x, scientific = input$ySci)) + } + if(!input$grey_mode){ p <- p + @@ -452,14 +464,24 @@ mod_boxplots_server <- function(id, r = r, session = session){ labs(fill="")') eval(parse(text=fun)) - # Y custom - listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(input$ymin, input$ymax)) + - scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) - - if(!is.na(input$ysteps)){ - listP[[FEAT[i]]] <- listP[[FEAT[i]]] + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), - labels = function(x) format(x, scientific = input$ySci)) - } + # Y custom + listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(input$ymin, input$ymax)) + + scale_y_continuous(labels = function(x) format(x, scientific = input$ySci)) + + if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ + print("ycustom1") + listP[[FEAT[i]]] <- listP[[FEAT[i]]] + scale_y_continuous(breaks = seq(input$ymin, input$ymax, input$ysteps), + labels = function(x) format(x, scientific = input$ySci)) + } + + if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ + print("ycustom2") + listP[[FEAT[i]]] <- listP[[FEAT[i]]] + coord_cartesian(ylim = c(0, max(tabfeat$value, na.rm = TRUE))) + + scale_y_continuous(breaks = seq(0, max(tabfeat$value, na.rm = TRUE), input$ysteps), + labels = function(x) format(x, scientific = input$ySci)) + } + + if(input$outlier_labs){ listP[[FEAT[i]]] <- listP[[FEAT[i]]] + -- GitLab From 6b8f2a89eddddaed9decf35c1066920f03473925 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Thu, 29 Feb 2024 16:41:13 +0100 Subject: [PATCH 4/8] update --- R/mod_boxplots.R | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index edbea03..e3a7ff1 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -827,16 +827,37 @@ mod_boxplots_server <- function(id, r = r, session = session){ typ1 <- stringr::str_split_1(feat1, "__")[2] %>% stringr::str_replace("/", "_") jpeg(glue::glue("{tmpdir}/figures_jpgs/figures_{systim}/{typ1}_boxplot_{met1}.jpeg"), width = 1422, height = 800, quality = 100, res = 150) + + # Y custom + + if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ + print("ycustom1") + YLIM <- c(input$ymin, input$ymax) + STEPS <- seq(input$ymin, input$ymax, input$steps) + } + + if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ + print("ycustom2") + YLIM <- c(0, max(tab1$value, na.rm = TRUE)) + STEPS <- seq(0, max(tab1$value, na.rm = TRUE), input$steps) + } + fact3 <- r_values$fact3ok + save(list = ls(all.names = TRUE), file = "debug.rdata", envir = environment()); print("SAVE0") if(input$outlier_labs){ car::Boxplot(as.formula(glue::glue("value~{r_values$fact3ok}")), data = tab1, main = feat1, cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = YLAB, - ylim=c(0,max(tab1$value, na.rm = TRUE))) + ylim=YLIM, axes = FALSE) + axis(1); axis(2, at = STEPS) + #c(0,max(tab1$value, na.rm = TRUE)) + }else{ boxplot(as.formula(glue::glue("value~{r_values$fact3ok}")), data = tab1, main = feat1, cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = "area", - ylim=c(0,max(tab1$value, na.rm = TRUE))) + ylim=YLIM, axes = FALSE) + axis(1); axis(2, at = STEPS) + #c(0,max(tab1$value, na.rm = TRUE)) } grid() -- GitLab From d9b9b66bdeae4e5fe908ffee9f98c1cd51914bc2 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Fri, 1 Mar 2024 17:33:33 +0100 Subject: [PATCH 5/8] update --- R/mod_boxplots.R | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index e3a7ff1..c8a9421 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -829,26 +829,33 @@ mod_boxplots_server <- function(id, r = r, session = session){ width = 1422, height = 800, quality = 100, res = 150) # Y custom + + if(!is.na(input$ymin) & is.na(input$ysteps) & is.na(input$ymax) ){ + YLIM <- c(0, max(tab1$value, na.rm = TRUE)) + STEPS <- NULL + } if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ print("ycustom1") YLIM <- c(input$ymin, input$ymax) - STEPS <- seq(input$ymin, input$ymax, input$steps) + STEPS <- format(seq(input$ymin, input$ymax, input$steps), scientific = input$ySci) } if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ print("ycustom2") YLIM <- c(0, max(tab1$value, na.rm = TRUE)) - STEPS <- seq(0, max(tab1$value, na.rm = TRUE), input$steps) + STEPS <- format(seq(0, max(tab1$value, na.rm = TRUE), input$steps), scientific = input$ySci) } + fact3 <- r_values$fact3ok - save(list = ls(all.names = TRUE), file = "debug.rdata", envir = environment()); print("SAVE0") + if(input$outlier_labs){ car::Boxplot(as.formula(glue::glue("value~{r_values$fact3ok}")), data = tab1, main = feat1, cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = YLAB, ylim=YLIM, axes = FALSE) - axis(1); axis(2, at = STEPS) + axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) + axis(2, at = STEPS, cex.axis = 0.6); graphics::box() #c(0,max(tab1$value, na.rm = TRUE)) }else{ @@ -856,13 +863,15 @@ mod_boxplots_server <- function(id, r = r, session = session){ cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = "area", ylim=YLIM, axes = FALSE) - axis(1); axis(2, at = STEPS) + axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) + axis(2, at = STEPS, cex.axis = 0.6); graphics::box() #c(0,max(tab1$value, na.rm = TRUE)) } grid() dev.off() } + save(list = ls(all.names = TRUE), file = "debug.rdata", envir = environment()); print("SAVE0") tar(filename, files = glue::glue("{tmpdir}/figures_jpgs/figures_{systim}") ) -- GitLab From d4a3c9e54b806723a5ff7bfe0fb40b600a427cc8 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Mon, 4 Mar 2024 17:36:07 +0100 Subject: [PATCH 6/8] update --- R/mod_boxplots.R | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index c8a9421..940bf14 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -777,7 +777,8 @@ mod_boxplots_server <- function(id, r = r, session = session){ req(r_values$tabF_melt2,r_values$fact3ok) tabF_melt2 <- r_values$tabF_melt2 - + print(input$ymin); print(input$ymax); print(input$steps) + for(i in 1:length(levels(tabF_melt2$features))){ if(input$nbPicPage == 4){ @@ -830,15 +831,26 @@ mod_boxplots_server <- function(id, r = r, session = session){ # Y custom + #validate steps + + if(!is.na(input$ymin) & is.na(input$ysteps) & is.na(input$ymax) ){ + print("ycustom01") YLIM <- c(0, max(tab1$value, na.rm = TRUE)) STEPS <- NULL } + + if(!is.na(input$ymin) & is.na(input$ysteps) & !is.na(input$ymax) ){ + print("ycustom02") + YLIM <- c(0, input$ymax) + STEPS <- NULL + } if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ print("ycustom1") + print(input$ymin); print(input$ymax); print(input$ysteps) YLIM <- c(input$ymin, input$ymax) - STEPS <- format(seq(input$ymin, input$ymax, input$steps), scientific = input$ySci) + STEPS <- format(seq(input$ymin, input$ymax, input$ysteps), scientific = input$ySci) } if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ @@ -847,6 +859,14 @@ mod_boxplots_server <- function(id, r = r, session = session){ STEPS <- format(seq(0, max(tab1$value, na.rm = TRUE), input$steps), scientific = input$ySci) } + # HERE + # if(!is.na(input$steps) & length(STEPS)> 100){ + # print("Too much steps on Y axis.") + # print(length(STEPS)) + # validate("Too much steps on Y axis.") + # return() + # } + fact3 <- r_values$fact3ok if(input$outlier_labs){ @@ -855,7 +875,7 @@ mod_boxplots_server <- function(id, r = r, session = session){ cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = YLAB, ylim=YLIM, axes = FALSE) axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) - axis(2, at = STEPS, cex.axis = 0.6); graphics::box() + axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() #c(0,max(tab1$value, na.rm = TRUE)) }else{ @@ -864,14 +884,14 @@ mod_boxplots_server <- function(id, r = r, session = session){ cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = "area", ylim=YLIM, axes = FALSE) axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) - axis(2, at = STEPS, cex.axis = 0.6); graphics::box() + axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() #c(0,max(tab1$value, na.rm = TRUE)) } grid() dev.off() } - save(list = ls(all.names = TRUE), file = "debug.rdata", envir = environment()); print("SAVE0") + # save(list = ls(all.names = TRUE), file = "debug.rdata", envir = environment()); print("SAVE0") tar(filename, files = glue::glue("{tmpdir}/figures_jpgs/figures_{systim}") ) -- GitLab From a089de20347fe19d964001c9e250421eadb19450 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Fri, 15 Mar 2024 09:57:24 +0100 Subject: [PATCH 7/8] update --- R/mod_boxplots.R | 74 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 13 deletions(-) diff --git a/R/mod_boxplots.R b/R/mod_boxplots.R index 940bf14..a9454bf 100644 --- a/R/mod_boxplots.R +++ b/R/mod_boxplots.R @@ -747,22 +747,65 @@ mod_boxplots_server <- function(id, r = r, session = session){ next } + + # Y custom + + #validate steps + if(!is.na(input$ymin) & is.na(input$ysteps) & is.na(input$ymax) ){ + # print("ycustom01") + YLIM <- c(0, max(tab1$value, na.rm = TRUE)) + STEPS <- NULL + } + + if(!is.na(input$ymin) & is.na(input$ysteps) & !is.na(input$ymax) ){ + # print("ycustom02") + YLIM <- c(input$ymin, input$ymax) + STEPS <- NULL + } + + if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ + # print("ycustom1") + print(input$ymin); print(input$ymax); print(input$ysteps) + YLIM <- c(input$ymin, input$ymax) + STEPS <- format(seq(input$ymin, input$ymax, input$ysteps), scientific = input$ySci) + } + + if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ + # print("ycustom2") + YLIM <- c(0, max(tab1$value, na.rm = TRUE)) + STEPS <- format(seq(0, max(tab1$value, na.rm = TRUE), input$steps), scientific = input$ySci) + } + + fact3 <- r_values$fact3ok + if(input$outlier_labs){ car::Boxplot(as.formula(glue::glue("value~{r_values$fact3ok}")), data = tab1, main = feat1, cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = YLAB, - ylim=c(0,max(tab1$value, na.rm = TRUE))) + ylim=YLIM, axes = FALSE) + axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) + if(!is.null(STEPS)){ + axis(2, at = STEPS, cex.axis = 0.6, labels=format(as.numeric(STEPS), scientific=TRUE)); graphics::box() + }else{ + axis(2); graphics::box() + } + }else{ boxplot(as.formula(glue::glue("value~{r_values$fact3ok}")), data = tab1, main = feat1, cex.main = 0.6, boxwex=.3, col = gg_color_hue(nrow(unique(tab1[r_values$fact3ok]))), cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = "area", - ylim=c(0,max(tab1$value, na.rm = TRUE))) + ylim=YLIM, axes = FALSE) + axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) + if(!is.null(STEPS)){ + axis(2, at = STEPS, cex.axis = 0.6, labels=format(as.numeric(STEPS), scientific=TRUE)); graphics::box() + }else{ + axis(2); graphics::box() + } } grid() } dev.off() - }) output$downloadTAR_rbase <- downloadHandler( @@ -832,29 +875,27 @@ mod_boxplots_server <- function(id, r = r, session = session){ # Y custom #validate steps - - if(!is.na(input$ymin) & is.na(input$ysteps) & is.na(input$ymax) ){ - print("ycustom01") + # print("ycustom01") YLIM <- c(0, max(tab1$value, na.rm = TRUE)) STEPS <- NULL } if(!is.na(input$ymin) & is.na(input$ysteps) & !is.na(input$ymax) ){ - print("ycustom02") - YLIM <- c(0, input$ymax) + # print("ycustom02") + YLIM <- c(input$ymin, input$ymax) STEPS <- NULL } if(!is.na(input$ysteps) & !is.na(input$ymin) & !is.na(input$ymax) ){ - print("ycustom1") + # print("ycustom1") print(input$ymin); print(input$ymax); print(input$ysteps) YLIM <- c(input$ymin, input$ymax) STEPS <- format(seq(input$ymin, input$ymax, input$ysteps), scientific = input$ySci) } if( is.na(input$ymin) | is.na(input$ymax) & !is.na(input$ysteps) ){ - print("ycustom2") + # print("ycustom2") YLIM <- c(0, max(tab1$value, na.rm = TRUE)) STEPS <- format(seq(0, max(tab1$value, na.rm = TRUE), input$steps), scientific = input$ySci) } @@ -875,7 +916,11 @@ mod_boxplots_server <- function(id, r = r, session = session){ cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = YLAB, ylim=YLIM, axes = FALSE) axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) - axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() + if(!is.null(STEPS)){ + axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() + }else{ + axis(2); graphics::box() + } #c(0,max(tab1$value, na.rm = TRUE)) }else{ @@ -884,8 +929,11 @@ mod_boxplots_server <- function(id, r = r, session = session){ cex.lab = 0.9, cex.axis = 0.5, las = 2, xlab = "", ylab = "area", ylim=YLIM, axes = FALSE) axis(1, at= 1:length(levels(tab1[,r_values$fact3ok])), labels = levels(tab1[,r_values$fact3ok]), las = 2, cex.axis = 0.6) - axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() - #c(0,max(tab1$value, na.rm = TRUE)) + if(!is.null(STEPS)){ + axis(2, at = STEPS, cex.axis = 0.6, labels=format(STEPS,scientific=input$ySci)); graphics::box() + }else{ + axis(2); graphics::box() + } } grid() -- GitLab From d8f8ab6c998598ab4ca85c0492860d7a495e1e91 Mon Sep 17 00:00:00 2001 From: Etienne Rifa <etienne.rifa[at]insa-toulouse.fr> Date: Fri, 15 Mar 2024 10:05:48 +0100 Subject: [PATCH 8/8] document version --- DESCRIPTION | 6 +++--- R/app_ui.R | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 234e9b4..d2a8b25 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: graphstatsr Title: graphstatsr -Version: 1.9.1 +Version: 1.10.0 Authors@R: person("Etienne", "Rifa", , "etienne.rifa@insa-toulouse.fr", role = c("cre", "aut")) Description: A shiny app to easily generate advanced graphics and some non @@ -20,11 +20,11 @@ Imports: ggstatsplot, glue, golem (>= 0.3.1), + graphics, gridExtra, htmltools, plotly, PMCMRplus, - RColorBrewer, reshape2, rhdf5, shiny (>= 1.6.0), @@ -47,4 +47,4 @@ Config/testthat/edition: 3 Encoding: UTF-8 Language: en-US LazyData: true -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/R/app_ui.R b/R/app_ui.R index e122d07..2e4b70a 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -19,7 +19,7 @@ app_ui <- function(request) { # ) dashboardPage(skin = "red", dashboardHeader( - title = "GraphStatsR 1.9.1", + title = "GraphStatsR 1.10.0", tags$li(class="dropdown",tags$a("Hosted by", img(src = SK8img, title = "SK8", height = "20px"), headerText = "Source code",href="https://sk8.inrae.fr/", target="_blank")), -- GitLab