diff --git a/R/gg1d.R b/R/gg1d.R index a4ecfde..31645d1 100644 --- a/R/gg1d.R +++ b/R/gg1d.R @@ -200,6 +200,7 @@ choose_colours <- function(data, palettes, plottable, ndistinct, coltype, colour #' @param legend_orientation_heatmap should legend orientation be "horizontal" or "vertical" #' @param fontsize_barplot_y_numbers fontsize of the text describing numeric barplot max & min values (number) #' @param cli_header Text used for h1 header. Included so it can be tweaked by packages that use gg1d, so they can customise how the info messages appear. +#' @param interactive_svg_width,interactive_svg_height width and height of the interactive graphic region (in inches). Only used when `interactive = TRUE`. #' @return ggiraph interactive visualisation #' #' @examples @@ -240,6 +241,8 @@ gg1d <- function( fontsize_values_heatmap = 3, colours_values_heatmap = "white", fontsize_barplot_y_numbers = 8, + interactive_svg_width = NULL, + interactive_svg_height = NULL, cli_header = "Running gg1d" ) { @@ -557,6 +560,8 @@ gg1d <- function( if(verbose >= 2) cli::cli_alert_info("Making plot interactive since `interactive = TRUE`") ggpatch <- ggiraph::girafe( ggobj = ggpatch, + width_svg = interactive_svg_width, + height_svg = interactive_svg_height, options = list( opts_hover = ggiraph::opts_hover(css = "stroke:black;cursor:pointer;r:5px;") ) diff --git a/inst/birdwatching.csv b/inst/birdwatching.csv index db8c801..c93d7f1 100644 --- a/inst/birdwatching.csv +++ b/inst/birdwatching.csv @@ -1,46 +1,46 @@ -Birdwatcher,Day,Magpies -Robert,Weekday,1 -Robert,Weekday,4 -Robert,Weekday,1 -Robert,Weekday,2 -Robert,Weekend,NA -Robert,Weekday,2 -Robert,Weekday,3 -Robert,Weekend,1 -Robert,Weekday,2 -Robert,Weekend,NA -Robert,Weekend,1 -Robert,Weekday,3 -Robert,Weekday,3 -Robert,Weekend,1 -Robert,Weekend,NA -Robert,Weekday,2 -Robert,Weekend,1 -Robert,Weekday,2 -Robert,Weekday,1 -Robert,Weekend,NA -Robert,Weekday,1 -Robert,Weekend,1 -Robert,Weekday,1 -Robert,Weekday,4 -Robert,Weekend,NA -Catherine,Weekday,1 -Catherine,Weekday,1 -Catherine,Weekend,1 -Catherine,Weekday,2 -Catherine,Weekday,2 -Catherine,Weekend,6 -Catherine,Weekday,1 -Catherine,Weekday,1 -Catherine,Weekend,2 -Catherine,Weekday,1 -Catherine,Weekday,1 -Catherine,Weekend,2 -Catherine,Weekday,4 -Catherine,Weekday,1 -Catherine,Weekend,1 -Catherine,Weekday,1 -Catherine,Weekday,1 -Catherine,Weekend,1 -Catherine,Weekday,1 -Catherine,Weekday,1 \ No newline at end of file +Magpies,Day,Birdwatcher +1,Weekday,Robert +4,Weekday,Robert +1,Weekday,Robert +2,Weekday,Robert +NA,Weekend,Robert +2,Weekday,Robert +3,Weekday,Robert +1,Weekend,Robert +2,Weekday,Robert +NA,Weekend,Robert +1,Weekend,Robert +3,Weekday,Robert +3,Weekday,Robert +1,Weekend,Robert +NA,Weekend,Robert +2,Weekday,Robert +1,Weekend,Robert +2,Weekday,Robert +1,Weekday,Robert +NA,Weekend,Robert +1,Weekday,Robert +1,Weekend,Robert +1,Weekday,Robert +4,Weekday,Robert +NA,Weekend,Robert +1,Weekday,Catherine +1,Weekday,Catherine +1,Weekend,Catherine +2,Weekday,Catherine +2,Weekday,Catherine +6,Weekend,Catherine +1,Weekday,Catherine +1,Weekday,Catherine +2,Weekend,Catherine +1,Weekday,Catherine +1,Weekday,Catherine +2,Weekend,Catherine +4,Weekday,Catherine +1,Weekday,Catherine +1,Weekend,Catherine +1,Weekday,Catherine +1,Weekday,Catherine +1,Weekend,Catherine +1,Weekday,Catherine +1,Weekday,Catherine \ No newline at end of file diff --git a/man/gg1d.Rd b/man/gg1d.Rd index 6a56a20..d1770e1 100644 --- a/man/gg1d.Rd +++ b/man/gg1d.Rd @@ -53,6 +53,8 @@ gg1d( fontsize_values_heatmap = 3, colours_values_heatmap = "white", fontsize_barplot_y_numbers = 8, + interactive_svg_width = NULL, + interactive_svg_height = NULL, cli_header = "Running gg1d" ) } @@ -158,6 +160,8 @@ Options are \code{alphabetical} or \code{frequency}} \item{fontsize_barplot_y_numbers}{fontsize of the text describing numeric barplot max & min values (number)} +\item{interactive_svg_width, interactive_svg_height}{width and height of the interactive graphic region (in inches). Only used when \code{interactive = TRUE}.} + \item{cli_header}{Text used for h1 header. Included so it can be tweaked by packages that use gg1d, so they can customise how the info messages appear.} } \value{ diff --git a/vignettes/gallery.Rmd b/vignettes/gallery.Rmd index 67f1274..3126f4c 100644 --- a/vignettes/gallery.Rmd +++ b/vignettes/gallery.Rmd @@ -117,6 +117,11 @@ gg1d( df_lazy_birdatcher, col_sort = "Magpies", show_legend = TRUE, + fontsize_y_text = 18, + fontsize_barplot_y_numbers = 12, + legend_text_size = 16, + legend_key_size = 1, + legend_nrow = 1, palettes = list( Birdwatcher = c(Robert = "#E69F00", Catherine = "#999999"), Day = c(Weekday = "#999999" ,Weekend = "#009E73")