Skip to content

Commit

Permalink
when facetting the x and y ranges are ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Konrad1991 committed Nov 12, 2024
1 parent b81943c commit f8e6f73
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
11 changes: 8 additions & 3 deletions bs/R/plottingInternally.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,15 @@ 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)
}

if (facetMode != "none") {
p <- addFacet(p, facetVar, facetMode, facetScales)
} else {
p <- addInterval(p, df, x, y, xMin, xMax, yMin, yMax)
}

if (fitMethod == "none" || fitMethod == "") {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
}
24 changes: 16 additions & 8 deletions bs/R/visualisation.R
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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(
Expand All @@ -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"))
)
)
}
Expand Down

0 comments on commit f8e6f73

Please sign in to comment.