plotly / plotly/plotly.R

plotly heatmap doesn't take a dataframe

Open
#329 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation enhancement
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

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")

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the documented plot_ly(nba_players, type = "heatmap") example with the supplied CSV, then inspect the heatmap figure-reference path. Done means either a data frame is accepted as documented or the reference clearly explains the required matrix conversion and its x/y labels.

Written by the indexing model from the issue text.

Assessment

Tech stack
plotly, r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.