Skip to content

Commit 7886274

Browse files
added legend_title_size so user can control the title size
1 parent 4b7b81e commit 7886274

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

NEWS.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
* added and exported `expand_modelframe` function
99
* added the possibility to select the shapes manually via `interval_shape` and `bsv_shape` (when shape is mapped to paramname or not)
1010
* added capability for user to reverse color legend separately via `legend_color_reverse`
11-
* added capability for user to specify legend titles via `interval_legend_title`
12-
* User can have more control on legends text and titles which influence merging
11+
* added capability for user to specify text for legend titles via `interval_legend_title` and `shape_legend_title` as well as text size via `legend_title_size`
1312

1413
# coveffectsplot 1.0.3
1514
* fixed a bug when ref_value when not equal 1 affecting y axis limits

R/forest_plot.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ label_wrap <- function(width) {
5656
#' @param xy_facet_text_bold Bold Facet text. Logical TRUE FALSE.
5757
#' @param x_label_text_size X axis labels size.
5858
#' @param y_label_text_size Y axis labels size.
59+
#' @param legend_title_size Legend title size if present.
5960
#' @param break_ylabel Split Y axis labels into multiple lines. Logical FALSE TRUE.
6061
#' @param y_label_text_width Number of characters to break Y axis labels.
6162
#' @param table_text_size Table text size.
@@ -363,6 +364,7 @@ forest_plot <- function(
363364
xy_facet_text_bold = TRUE,
364365
x_label_text_size = 16,
365366
y_label_text_size = 16,
367+
legend_title_size = 12,
366368
break_ylabel = FALSE,
367369
y_label_text_width = 25,
368370
table_text_size = 7,
@@ -800,6 +802,7 @@ forest_plot <- function(
800802
legend.position = legend_position,
801803
legend.justification = c(0.5, 0.5),
802804
legend.direction = "horizontal",
805+
legend.title = ggplot2::element_text(size = legend_title_size),
803806
legend.key.width = ggplot2::unit(3, "line"),
804807
strip.text.x = x.strip.text,
805808
strip.text.y = y.strip.text,

inst/shiny/server.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ function(input, output, session) {
258258
xy_facet_text_bold = ..(input$boldfacettext),
259259
x_label_text_size = ..(input$xlablesize),
260260
y_label_text_size = ..(input$ylablesize),
261+
legend_title_size = ..(input$legendtitlesize),
261262
break_ylabel = ..(input$breakylabel),
262263
y_label_text_width= ..(input$ylabeltextwidth),
263264
table_text_size = ..(input$tabletextsize),

inst/shiny/ui.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,10 @@ fluidPage(
401401
checkboxInput('combineareareflegend',
402402
'Combine Ref and Area Legends if they share the same text ?',value = TRUE),
403403
checkboxInput('combineintervalshapelegend',
404-
'Combine Interval and Shape Legends?',value = TRUE)
404+
'Combine Interval and Shape Legends?',value = TRUE),
405+
sliderInput("legendtitlesize", "Text size of legend(s) title(s) ",
406+
min=1, max=32, value= 16, step=0.5)
407+
405408
)#tabpanel
406409
) # tabsetpanel
407410
) # closes the column 3

0 commit comments

Comments
 (0)