bcgov / ssdtools

An R package to fit and plot Species Sensitivity Distributions (SSDs)
https://bcgov.github.io/ssdtools/
Apache License 2.0
29 stars 16 forks source link

Add functionality for french plots #85

Open joethorley opened 4 years ago

joethorley commented 4 years ago

Demonstration of require functionality

library(ssdtools)
library(ggplot2)
library(scales)

fits <- ssd_fit_dists(boron_data,
  left = "Conc",
  dists = c("burrIII2", "lnorm", "gamma")
)

pred <- predict(fits, ci = TRUE)

ssd_plot(boron_data, pred, left = "Conc", label = "Species", color = "Group",
           xlab = "Concentration (mg/L)", hc = 5) +
  expand_limits(x = 3000) +
scale_x_continuous("Concentration (mg/L)",
      breaks = scales::trans_breaks("log10", function(x) 10^x),
      labels = label_comma(big.mark = " ")
    ) +
  scale_y_continuous("Percent of Species Affected", labels = label_percent(suffix = " %"))
joethorley commented 4 years ago

Could either have a language argument to ssd_plot that controls labels if not overridden plus big.mark and percent suffix or allow user to pass those.

joethorley commented 2 years ago

Format the X axis so that the thousands separator is a space and not a decimal ex. 20000 instead of 20,000. Make this option available in the Shiny App.