R/les_histogrammes.R

Defines functions les_histogrammes

Documented in les_histogrammes

#' lLs histogrammes
#'
#' @param Z a matrix
#' @param Y another matrix
#' @param titre title if histograms
#' @param nom_axeX x label
#' @param nom_axeY y label
#'
#' @return a plot with 2 histograms
#' @export
#'
#' @examples
#' les_histogrammes(matrix(1:100, nrow = 10), matrix(101:200, nrow = 10))
les_histogrammes <- function(Z,Y, titre = 'Histogrammes', nom_axeX = "", nom_axeY = ""){
  Z <- as.vector(Z)
  Z <- as.data.frame(Z)
  Y <- as.vector(Y)
  Y <- as.data.frame(Y)

  p <- ggplot() +
    ggplot2::geom_histogram(data = Y, aes(x = Y, y=..count../sum(..count..)), color="black", fill= "#01BDC2")+
    ggplot2::geom_histogram(data = Z, aes(x = Z, y=..count../sum(..count..)), color="black", fill="#F8766D", alpha=0.5)+

    labs(title = titre,
         x = nom_axeX,
         y = nom_axeY)

  return(p)
}
C-Juliette/randomfields documentation built on Sept. 3, 2023, 5:56 a.m.