#' Ploting Curves
#'
#' @param curve Curve "kv", "zv" or "sigma"
#' @param marke marke, Brand
#' @param cylinder cylinder name
#' @param diameter Diameter of the Valve
#' @param op_points table with the operations points
#'
#' @return curves ggplot
#' @export
#'
#' @examples
#' library(dplyr)
#' library(ggplot2)
#' op_data <- tibble::tibble(p1 = c(2,3), p2 = c(1,1), flow = c(500, 750))
#' op_points <- operation_points(op_data, "VAG", "E", 200)
#' plot_curves("kv", "VAG", "E", 200, op_points)
#' plot_curves("zv", "VAG", "E", 200, op_points)
#' plot_curves("sigma", "VAG", "E", 200, op_points)
plot_curves <- function(curve, marke, cylinder, diameter, op_points) {
# https://www.r-bloggers.com/2019/08/no-visible-binding-for-global-variable/
cyl_name <- NULL
p_color <- 'black'
p_size <- 4
cyl_data <- cylinder_parameter(marke) %>%
filter(cyl_name == cylinder)
if ( curve == "kv") {
plot_kv(cyl_data$cyl_name, cyl_data$kv_b, cyl_data$kv_d, cyl_data$kv_e, cyl_data$zvs, diameter) +
ggplot2::geom_point(data = op_points, aes(x = .data$position, y = .data$kv), color = p_color, size = p_size)
}
else if ( curve == "zv") {
plot_zv(cyl_data$cyl_name, cyl_data$kv_b, cyl_data$kv_d, cyl_data$kv_e, cyl_data$zvs) +
ggplot2::geom_point(data = op_points, aes(x = .data$position, y = .data$zv), color = p_color, size = p_size)
}
else if ( curve == "sigma") {
plot_sigma(cyl_data$cyl_name, cyl_data$kv_b, cyl_data$kv_d, cyl_data$kv_e, cyl_data$fls) +
ggplot2::geom_point(data = op_points, aes(x = .data$position, y = .data$sigma_value), color = p_color, size = p_size)
}
else {
NA
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.