Commit 170030e5 authored by houyun's avatar houyun
Browse files

change use_md to parse

parent af706ca4
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -3,8 +3,8 @@
#' @param md a matrix_data or md_tbl object or any can be converted to matrix_data.
#' @param mapping default list of aesthetic mappings to use for plot.
#' @param drop logical. If TRUE, the unused labels will be removed.
#' @param use_md logical. if TRUE, will use \code{ggtext::element_markdown()} to
#' draw the axis labels.
#' @param parse logical or function generated by \code{parse_func()}.
#' @param use_md deprecated.
#' @param facets a parameters list of \code{facet_wrap}.
#' @param facets_order character vector to set the order of facet panels.
#' @param ... passing to \code{\link{as_matrix_data}}.
@@ -25,9 +25,10 @@
hyplot <- function(md,
                   mapping = NULL,
                   drop = TRUE,
                   use_md = NULL,
                   parse = FALSE,
                   facets = list(),
                   facets_order = NULL,
                   use_md,
                   ...) {
  if (!is_matrix_data(md) && !is_grouped_matrix_data(md) && !is_md_tbl(md)) {
    if (!"name" %in% names(list(...))) {
@@ -48,9 +49,9 @@ hyplot <- function(md,
  row_names <- rev(row_names(md))
  col_names <- col_names(md)

  if(is.null(use_md)) {
    use_md <- requireNamespace("ggtext", quietly = TRUE) &&
              is_richtext(c(row_names, col_names))
  if(!missing(use_md)) {
    warning("'use_md' has been deprecated,\n",
            "please set 'parse' parameter instead.", call. = FALSE)
  }

  if(type == "full" || isTRUE(diag)) {
@@ -70,6 +71,11 @@ hyplot <- function(md,
    xbreaks <- xlabels <- col_names
    ybreaks <- ylabels <- row_names
  }
  need_parse <- isTRUE(parse) || is.function(parse)
  if (need_parse) {
    xlabels <- label_formula(parse = parse)
    ylabels <- label_formula(parse = parse)
  }

  xaxis_pos <- switch(type, upper = "top", "bottom")
  yaxis_pos <- switch(type, upper = "right", "left")
@@ -104,7 +110,7 @@ hyplot <- function(md,


  # adjust the default theme
  p <- p + theme_hy(legend.position = guide_pos, use_md = use_md)
  p <- p + theme_hy(legend.position = guide_pos)

  # auto facets
  if (isTRUE(grouped)) {
+5 −3
Original line number Diff line number Diff line
@@ -8,9 +8,10 @@ hyplot(
  md,
  mapping = NULL,
  drop = TRUE,
  use_md = NULL,
  parse = FALSE,
  facets = list(),
  facets_order = NULL,
  use_md,
  ...
)
}
@@ -21,13 +22,14 @@ hyplot(

\item{drop}{logical. If TRUE, the unused labels will be removed.}

\item{use_md}{logical. if TRUE, will use \code{ggtext::element_markdown()} to
draw the axis labels.}
\item{parse}{logical or function generated by \code{parse_func()}.}

\item{facets}{a parameters list of \code{facet_wrap}.}

\item{facets_order}{character vector to set the order of facet panels.}

\item{use_md}{deprecated.}

\item{...}{passing to \code{\link{as_matrix_data}}.}
}
\value{