From f8e6f735bd8967eff59336520ccc8330747642e0 Mon Sep 17 00:00:00 2001 From: Konrad1991 Date: Tue, 12 Nov 2024 10:45:47 +0100 Subject: [PATCH] when facetting the x and y ranges are ignored --- bs/R/plottingInternally.R | 11 ++++++++--- bs/R/visualisation.R | 24 ++++++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/bs/R/plottingInternally.R b/bs/R/plottingInternally.R index 366d0ce..15eb50e 100644 --- a/bs/R/plottingInternally.R +++ b/bs/R/plottingInternally.R @@ -172,7 +172,6 @@ DotplotFct <- function(df, x, y, xLabel, yLabel, p <- p + xlab(xLabel) p <- p + ylab(yLabel) - p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) if (colourVar != "") { p <- p + guides(colour = guide_legend(title = legendTitleColour)) p <- p + scale_color_brewer(palette = colourTheme) @@ -180,6 +179,8 @@ DotplotFct <- function(df, x, y, xLabel, yLabel, if (facetMode != "none") { p <- addFacet(p, facetVar, facetMode, facetScales) + } else { + p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) } if (fitMethod == "none" || fitMethod == "") { @@ -241,6 +242,8 @@ DotplotFct <- function(df, x, y, xLabel, yLabel, } if (facetMode != "none") { p <- addFacet(p, "Panel", facetMode, facetScales) + } else { + p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) } return(p) @@ -289,9 +292,10 @@ BoxplotFct <- function(df, x, y, xLabel, yLabel, p <- p + guides(colour = guide_legend(title = legendTitleColour)) p <- p + scale_fill_brewer(palette = fillTheme) p <- p + scale_color_brewer(palette = colourTheme) - p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) if (facetMode != "none") { p <- addFacet(p, facetVar, facetMode, facetScales) + } else { + p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) } return(p) } @@ -326,9 +330,10 @@ LineplotFct <- function(df, x, y, xLabel, yLabel, p <- p + ylab(yLabel) p <- p + guides(colour = guide_legend(title = legendTitleColour)) p <- p + scale_color_brewer(palette = colourTheme) - p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) if (facetMode != "none") { p <- addFacet(p, facetVar, facetMode, facetScales) + } else { + p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax) } return(p) } diff --git a/bs/R/visualisation.R b/bs/R/visualisation.R index 6ec6e3d..a765e0a 100644 --- a/bs/R/visualisation.R +++ b/bs/R/visualisation.R @@ -10,7 +10,9 @@ visSidebarUI <- function(id) { div( class = "boxed-output", uiOutput(NS(id, "yVar")), - uiOutput(NS(id, "xVar")) + uiOutput(NS(id, "xVar")), + textInput(NS(id, "xaxisText"), "X axis label", value = "x label"), + textInput(NS(id, "yaxisText"), "Y axis label", value = "y label") ), div( class = "boxed-output", @@ -31,7 +33,10 @@ visSidebarUI <- function(id) { ), selectize = FALSE ) - ), + ) + ), + div( + class = "boxed-output", uiOutput(NS(id, "col")), textInput(NS(id, "legendTitleCol"), "Legend title for colour", value = "Title colour"), selectInput(NS(id, "theme"), "Choose a 'colour' theme", @@ -46,7 +51,14 @@ visSidebarUI <- function(id) { "Set3" = "Set3" ), selectize = FALSE - ), + ) + ), + div( + class = "boxed-output", + uiOutput(NS(id, "facetBy")), + uiOutput(NS(id, "facetScales")) + ), + div( class = "boxed-output", radioButtons(NS(id, "xType"), "Type of x", choices = c( @@ -55,12 +67,8 @@ visSidebarUI <- function(id) { ), selected = "factor" ), - textInput(NS(id, "xaxisText"), "X axis label", value = "x label"), - textInput(NS(id, "yaxisText"), "Y axis label", value = "y label"), uiOutput(NS(id, "XRange")), - uiOutput(NS(id, "YRange")), - uiOutput(NS(id, "facetBy")), - uiOutput(NS(id, "facetScales")) + uiOutput(NS(id, "YRange")) ) ) }