StatisticsNZ / simplevis

Simple visualisation with ggplot2 and leaflet wrappers
https://StatisticsNZ.github.io/simplevis
Other
86 stars 11 forks source link

pointrange & hhpointrange: rename xmiddle_var as x_var #432

Closed davidhodge931 closed 2 years ago

davidhodge931 commented 2 years ago

Too long and makes it difficult to read

davidhodge931 commented 2 years ago
library(dplyr)
library(simplevis)
library(palmerpenguins)

plot_data <- penguins %>%
  group_by(sex) %>%
  summarise(q50 = median(body_mass_g, na.rm = TRUE),
            q25 = quantile(body_mass_g, probs = 0.25, na.rm = TRUE),
            q75 = quantile(body_mass_g, probs = 0.75, na.rm = TRUE))

gg_hpointrange(
  plot_data,
  xmiddle_var = q50,
  xmin_var = q25,
  xmax_var = q75,
  y_var = sex,
  x_title = "Body mass g", 
  y_na_rm = TRUE)

gg_hpointrange(
  plot_data,
  x_var = q50,
  xmin_var = q25,
  xmax_var = q75,
  y_var = sex,
  x_title = "Body mass g", 
  y_na_rm = TRUE)
davidhodge931 commented 2 years ago

Āligns with ggplot as well, so less confusing

davidhodge931 commented 2 years ago

Done