plotly / plotly/plotly.R

Ticktext doesn't show for some numerical values in parallel coordinates plotting.

Open
#1,096 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

plotly.js
Dominant language
R
Stars
2.7k
Forks
641
PR merge metrics
No merged PRs in 30d

Description

Currently, I am trying to plot categorical variables in plotly. I run this

(This has incorrect result)

library(plotly)

p <- plot_ly(type = 'parcoords', line = list(color = 'blue'),
             dimensions = list(
               list(range = c(1,5),
                    constraintrange = c(1,2),
                    label = 'A', values = c(1,4)),
               list(range = c(1,5),
                    tickvals = c(1.5,3,4.5),
                    label = 'B', values = c(3,1.5)),
               list(range = c(1,2),
                    tickvals = c(1,2),
                    label = 'C', values = c(2,4),
                    ticktext = c('0','1')),

               list(range = c(1,5),
                    label = 'D', values = c(4,2))
               )
             )
p

and this: (this has correct, expected result)

library(plotly)

p <- plot_ly(type = 'parcoords', line = list(color = 'blue'),
             dimensions = list(
               list(range = c(1,5),
                    constraintrange = c(1,2),
                    label = 'A', values = c(1,4)),
               list(range = c(1,5),
                    tickvals = c(1.5,3,4.5),
                    label = 'B', values = c(3,1.5)),
               list(range = c(1,2),
                    tickvals = c(1,2),
                    label = 'C', values = c(2,4),
                    ticktext = c(' 0 ',' 1 ')),

               list(range = c(1,5),
                    label = 'D', values = c(4,2))
               )
             )
p

Notice that the only change is the 3rd ticktext. With spaces, it works correctly but without, it doesn't. Swapping the ('0', '1') out with ('1', '2') or ('male', 'female') also works correctly.

screen shot 2017-08-05 at 12 28 42 pm

Expected behavior: There should be a 0 label at the bottom and 1 at the top.
Actual behavior: The top label is missing.

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 running the two R plot_ly parcoords examples from the issue and compare the ticktext values with and without spaces. Trace the parallel-coordinates tick-label handling from that entry point; done means both numeric labels, including the top 1, render without added spaces.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.