diff --git a/R/heatmaply.R b/R/heatmaply.R
index d1d6203..765e912 100644
--- a/R/heatmaply.R
+++ b/R/heatmaply.R
@@ -571,6 +571,7 @@ heatmaply.default <- function(x,
label_format_fun = function(...) format(..., digits = 4),
labRow = NULL, labCol = NULL,
custom_hovertext = NULL,
+ suppress_default_hovertext = F,
col = NULL,
dend_hoverinfo = TRUE,
side_color_colorbar_len = 0.3,
@@ -757,6 +758,7 @@ heatmaply.default <- function(x,
scale = scale,
na.rm = na.rm,
custom_hovertext = custom_hovertext,
+ suppress_default_hovertext = suppress_default_hovertext,
labRow = labRow,
labCol = labCol,
...
@@ -808,6 +810,7 @@ heatmaply.default <- function(x,
point_size_name = point_size_name,
label_format_fun = label_format_fun,
dend_hoverinfo = dend_hoverinfo,
+ suppress_default_hovertext = suppress_default_hovertext,
side_color_colorbar_len = side_color_colorbar_len,
plotly_source = plotly_source,
height = height,
@@ -887,6 +890,7 @@ heatmaply.heatmapr <- function(x,
point_size_name = "Point size",
label_format_fun = function(...) format(..., digits = 4),
custom_hovertext = x[["matrix"]][["custom_hovertext"]],
+ suppress_default_hovertext = F,
dend_hoverinfo = TRUE,
side_color_colorbar_len = 0.3,
plotly_source = "A",
@@ -1017,6 +1021,7 @@ heatmaply.heatmapr <- function(x,
point_size_name = point_size_name,
label_format_fun = label_format_fun,
custom_hovertext = custom_hovertext,
+ suppress_default_hovertext = suppress_default_hovertext,
showticklabels = showticklabels
)
} else if (plot_method == "plotly") {
diff --git a/R/plots.R b/R/plots.R
index 463d8f4..81e1132 100644
--- a/R/plots.R
+++ b/R/plots.R
@@ -24,6 +24,7 @@ ggplot_heatmap <- function(xx,
point_size_name = "Point size",
label_format_fun = function(...) format(..., digits = 4),
custom_hovertext = NULL,
+ suppress_default_hovertext = FALSE,
showticklabels = c(TRUE, TRUE),
...) {
theme_clear_grid_heatmap <- theme(
@@ -60,11 +61,14 @@ ggplot_heatmap <- function(xx,
col <- label_names[[2]]
val <- label_names[[3]]
- mdf[["text"]] <- paste0(
- row, ": ", mdf[[1]], "
",
- col, ": ", mdf[[2]], "
",
- val, ": ", label_format_fun(mdf[[3]])
- )
+ if(!suppress_default_hovertext)
+ {
+ mdf[["text"]] <- paste0(
+ row, ": ", mdf[[1]], "
",
+ col, ": ", mdf[[2]], "
",
+ val, ": ", label_format_fun(mdf[[3]])
+ )
+ }
if (type == "heatmap") {
geom <- "geom_tile"
@@ -77,10 +81,13 @@ ggplot_heatmap <- function(xx,
geom <- "geom_point"
geom_args <- list()
if (!is.null(point_size_mat)) {
- mdf[["text"]] <- paste(
- mdf[["text"]], "
",
- point_size_name, ": ", label_format_fun(mdf[[4]])
- )
+ if(!suppress_default_hovertext)
+ {
+ mdf[["text"]] <- paste(
+ mdf[["text"]], "
",
+ point_size_name, ": ", label_format_fun(mdf[[4]])
+ )
+ }
aes_mapping <- aes(
color = .data[[val]],
text = .data$text,
@@ -95,7 +102,13 @@ ggplot_heatmap <- function(xx,
}
}
if (!is.null(custom_hovertext)) {
- mdf[["text"]] <- paste0(mdf[["text"]], "
", custom_hovertext)
+ if(!suppress_default_hovertext)
+ {
+ mdf[["text"]] <- paste0(mdf[["text"]], "
", custom_hovertext)
+ } else
+ {
+ mdf[["text"]] <- reshape2::melt(as.matrix(custom_hovertext))[[3]]
+ }
}
geom_args[["mapping"]] <- aes_mapping
diff --git a/man/heatmaply.Rd b/man/heatmaply.Rd
index 584bd61..4d2df0f 100644
--- a/man/heatmaply.Rd
+++ b/man/heatmaply.Rd
@@ -474,6 +474,10 @@ backward compatibility with gplots::heatmap.2.}
If plot_method is "plotly" then just this text is displayed; if plot_method
if "ggplot" then it is appended to the existing text.}
+\item{suppress_default_hovertext}{Logical (FALSE) indicating whether to hide the
+default hovertext for plot_method = "ggplot" of row, column, value, and Point
+size.}
+
\item{dend_hoverinfo}{Boolean value which controls whether mouseover text
is shown for the row and column dendrograms.}