create_plot_ggiraph: create_plot_ggiraph()

View source: R/fct_helpers.R

create_plot_ggiraphR Documentation

create_plot_ggiraph()

Description

Creates a girafe object from a facetted ggplot bar plot for use in renderGirafe

Usage

create_plot_ggiraph(
  data,
  n_communes,
  var_year,
  var_commune,
  unit,
  var_cat,
  var_values,
  geom,
  color_palette,
  dodge = FALSE,
  free_y = FALSE,
  legend_title = NULL,
  height_svg,
  width_svg
)

Arguments

data

the data to provide

n_communes

number of selected communes, used to control the width of facets

var_year

the year variable

var_commune

the commune variable

unit

the unit to append in <var_values>

var_cat

the optional categorical variable

var_values

the variables containing the values

geom

the type of geom for the plot : either 'col' or 'line'

color_palette

a named vector of values-colors if <var_cat> is supplied, that should match <var_cat> items

dodge

if geom = 'col' and <var_cat> is supplied : controls whether the cols are in a stacked or dodge position

free_y

if <n_communes> is higher than 1, controls whether the y axis is independent for each facet or not

legend_title

a string containing the legend title if <var_cat> is supplied

height_svg, width_svg

dimensions of ggiraph output

Value

an interactive girafe object


vdes2020/eneRgyVD documentation built on July 3, 2025, 7:36 p.m.