plotly / plotly/plotly.R

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

未关闭
#1,096 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

plotly.js
主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先运行 issue 中的两个 R plot_ly parcoords 示例,并比较有空格和无空格时的 ticktext 值。从该入口点追踪平行坐标刻度标签的处理;当两个数字标签(包括顶部的 1)都能在未添加空格的情况下渲染时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。