Skip to content

plotly heatmap doesn't take a dataframe #329

Open
@ziyadsaeed

Description

@ziyadsaeed

The figure reference documentation says

plot_ly(df, type="heatmap"[, ...])

the df in the code above indicates a data frame
The code below doesn't work

url <- "http://datasets.flowingdata.com/ppg2008.csv"
nba_players <- read.csv(url, row.names = 1)

plot_ly(nba_players, type = "heatmap")

A solution is to use a data.matrix

plot_ly(z = data.matrix(nba_players), 
           x = colnames(nba_players), 
           y = row.names(nba_players), 
           type = "heatmap")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions