Skip to content

ggplotly on geom_tile: unnecessary warning produced #1670

@alanocallaghan

Description

@alanocallaghan

When converting geom_tile with ggplotly, the warning 'heatmap' objects don't have these attributes: 'showlegend' is produced. I think this is just a mismatch in the internal API and should be an easy fix.

Seems to me that the issue arises here, where a value is assigned to it for all trace types. At least, if I comment this line out, the warning doesn't occur. https://github.com/ropensci/plotly/blob/e02a704d3743ef3dc59714af1b9fc6d3c248186e/R/ggplotly.R#L559

(link was out of date, I think the permalink is correct)

library("ggplot2")
library("reshape2")
library("plotly")
#> [startup msgs] 
mdf <- melt(as.matrix(mtcars))
g <- ggplot(mdf, aes(x = Var1, y = Var2, fill = value)) + geom_tile()
ggplotly(g)
#> Warning: 'heatmap' objects don't have these attributes: 'showlegend'
#> Valid attributes include:
#> 'type', 'visible', 'opacity', 'name', 'uid', 'ids', 'customdata', 'meta', 'hoverinfo', 'hoverlabel', 'stream', 'transforms', 'uirevision', 'z', 'x', 'x0', 'dx', 'y', 'y0', 'dy', 'text', 'hovertext', 'transpose', 'xtype', 'ytype', 'zsmooth', 'connectgaps', 'xgap', 'ygap', 'zhoverformat', 'hovertemplate', 'zauto', 'zmin', 'zmax', 'zmid', 'colorscale', 'autocolorscale', 'reversescale', 'showscale', 'colorbar', 'coloraxis', 'xcalendar', 'ycalendar', 'xaxis', 'yaxis', 'idssrc', 'customdatasrc', 'metasrc', 'hoverinfosrc', 'zsrc', 'xsrc', 'ysrc', 'textsrc', 'hovertextsrc', 'hovertemplatesrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions