From 768c1026a87487346044dfd37f5623cdfabb6d0e Mon Sep 17 00:00:00 2001 From: Jason Everett Date: Tue, 23 Jun 2026 16:06:08 +1000 Subject: [PATCH] Update legend position --- R/splnr_plotting.R | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/R/splnr_plotting.R b/R/splnr_plotting.R index ca9b135..481c7dd 100644 --- a/R/splnr_plotting.R +++ b/R/splnr_plotting.R @@ -224,8 +224,10 @@ splnr_plot <- function(df, ) + ggplot2::guides(fill = ggplot2::guide_colourbar( order = -1, + barwidth = ggplot2::unit(2, "lines"), + barheight = ggplot2::unit(10, "lines"), title.position = "right", - title.theme = ggplot2::element_text(angle = 270) + title.theme = ggplot2::element_text(angle = 270, vjust = 0.5) )) return(gg) @@ -270,8 +272,10 @@ splnr_plot <- function(df, ggplot2::guides( fill = ggplot2::guide_colourbar( order = 1, + barwidth = ggplot2::unit(2, "lines"), + barheight = ggplot2::unit(10, "lines"), title.position = "right", - title.theme = ggplot2::element_text(angle = 270) + title.theme = ggplot2::element_text(angle = 270, vjust = 0.5) ), colour = "none" ) @@ -669,7 +673,7 @@ splnr_plot_costOverlay <- function(soln, barwidth = ggplot2::unit(2, "lines"), barheight = ggplot2::unit(10, "lines"), title.position = "right", - title.theme = ggplot2::element_text(angle = 270) + title.theme = ggplot2::element_text(angle = 270, vjust = 0.5) ) ) + # Set coordinate limits based on the bounding box of the cost data. @@ -1165,8 +1169,10 @@ splnr_plot_importanceScore <- function(soln, labels = lab, # Apply custom labels. guide = ggplot2::guide_colourbar( # Configure color bar legend. title = legendTitle, # Set legend title. + barwidth = ggplot2::unit(2, "lines"), + barheight = ggplot2::unit(10, "lines"), title.position = "right", - title.theme = ggplot2::element_text(angle = 270) + title.theme = ggplot2::element_text(angle = 270, vjust = 0.5) ) ) + # Set coordinate limits based on the bounding box of the scored solution. @@ -1330,9 +1336,10 @@ splnr_plot_corrMat <- function(x, colourGradient = c("#BB4444", "#FFFFFF", "#447 limits = c(-1, 1), # Set fixed limits for the color scale. guide = ggplot2::guide_colourbar( # Configure color bar legend. title = legendTitle, # Set legend title. - barwidth = 2, barheight = 10, # Set dimensions of the color bar. + barwidth = ggplot2::unit(2, "lines"), + barheight = ggplot2::unit(10, "lines"), title.position = "right", - title.theme = ggplot2::element_text(angle = 270) + title.theme = ggplot2::element_text(angle = 270, vjust = 0.5) ) ) + # Rotate x-axis labels for better readability.