Skip to content

Discrete (factor) Scales missing Tooltip #515

@bhive01

Description

@bhive01

I'm making heatmaps using geom_tile for correlation matrices.
Using my previous MRE:

require(ggplot2)
require(plotly)

randomName <- function(n) {
    random.string <- rep(NA, n)
    randomizeString <- function(x) {
        a <-sample(letters, 1, replace = TRUE)
        return(a)
    }
    return(paste(c(sapply(random.string, randomizeString, simplify = TRUE)), collapse = ""))
}

xvar = replicate(10, randomName(15))
df1 <- data.frame(x = xvar, y = xvar, z = runif(10) )

g = ggplot(df1, aes(x,y,fill=z)) +
        geom_tile() +
        theme(axis.text.x = element_text(angle = 45, vjust = 1,  size = 12, hjust = 1))
ggplotly(g)

When you hover over the volcano examples here:
https://plot.ly/ggplot2/geom_tile/
all of the numbers are lit up in the tooltip. Sometimes these matrices can be large and having it tell you which x and y you're on as well as the value would be really needed.

This exclusion appears to have been made on purpose:
https://github.com/ropensci/plotly/blob/master/R/ggplotly.R#L195-L203
Though, I'm not sure I understand the code completely.

When I try and force a tooltip using tooltip = c("y", "x", "fill") it doesn't work. I would really like the ability to force tooltips, because I don't think it's misleading in my case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions