R/fct_plot_zv.R

Defines functions plot_zv

Documented in plot_zv

#' Plot Zeta Value Curve
#'
#' @param cyl_name  Name of the control characteristic
#' @param b steepness
#' @param d upper value
#' @param e the effective dose
#' @param zvs Resistance Coefficient Zeta full open
#'
#' @import ggplot2 latex2exp glue hyd4gpv
#'
#' @return ggplot graphic. Zeta Value Curve
#' @export
#'
#' @examples
#' library(dplyr)
#' param <- cylinder_parameter("VAG") %>% filter(cyl_name == "E")
#' plot_zv(param$cyl_name,  param$kv_b,  param$kv_d, param$kv_e, param$zvs)
#'
#'
plot_zv <- function(cyl_name, b, d, e, zvs){

  Max.zvs <- format(zvs,digits = 2, nsmall = 0, big.mark = ',')

  x <- data.frame(x = 5:100)
  ggplot2::ggplot( data = x, mapping = aes(x = x)) +
    stat_function( fun = function(x) {zv_function( x, b, d, e, zvs )},
                   size = 1, color = "green") +
    scale_y_log10() +
    scale_x_continuous( breaks = seq(0, 100, 10)) +
    annotation_logticks(sides = "lr") +
    labs( title    = latex2exp::TeX(glue::glue("Zeta Value $\\zeta_{v}$ for cilinder Typ <<cyl_name>>", .open = "<<", .close = ">>")),
          subtitle = latex2exp::TeX(glue::glue("$zeta_{v_{100\\%}}=$ <<Max.zvs>>", .open = "<<", .close = ">>")),
          caption  = "Dr.Trujillo",
          x        = "Opening degree (%)",
          y        = latex2exp::TeX('$\\zeta_{v}$')) +
    theme_bw()
}
ratral/gpvapp documentation built on May 13, 2022, 12:51 a.m.