plotly / plotly/plotly.R

Plotly Subplot Function Issue

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

还没有人认领这个 Issue。

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

描述

Please briefly describe your problem and what output you expect. If you have a question, please don't use this form, but instead ask on the community forum http://community.plot.ly/c/api/r or stackoverflow http://stackoverflow.com.

Please include a minimal reprex. The goal of a reprex is to make it as easy as possible for me to recreate your problem so that I can fix it. If you've never heard of a reprex before, start by reading https://github.com/tidyverse/reprex#readme, and follow the advice further down the page. Do NOT include session info unless it's explicitly asked for, or you've used reprex::reprex(..., si = TRUE) to hide it away.

Delete these instructions once you have read them.


I am trying to plot two plotly images side by side using the tutorial laid out here. However, I keep getting this error:

Warning messages:
1: No source found 
2: No config found 
3: 'layout' objects don't have these attributes: 'NA'
Valid attributes include:
'font', 'title', 'uniformtext', 'autosize', 'width', 'height', 'margin', 'paper_bgcolor', 'plot_bgcolor', 'separators', 'hidesources', 'showlegend', 'colorway', 'datarevision', 'uirevision', 'editrevision', 'selectionrevision', 'template', 'modebar', 'meta', 'transition', '_deprecated', 'clickmode', 'dragmode', 'hovermode', 'hoverdistance', 'spikedistance', 'hoverlabel', 'selectdirection', 'grid', 'calendar', 'xaxis', 'yaxis', 'ternary', 'scene', 'geo', 'mapbox', 'polar', 'radialaxis', 'angularaxis', 'direction', 'orientation', 'editType', 'legend', 'annotations', 'shapes', 'images', 'updatemenus', 'sliders', 'colorscale', 'coloraxis', 'metasrc', 'barmode', 'bargap', 'mapType'

My plotly objects are defined in the same way as follows:

  log10_plot <- plot_ly(data=log10numi_frame,x=log10numi_frame$`Log10 Cell Index`,y=log10numi_frame$`Log10 nUMI`, type="scatter", mode = "lines", name=paste0(sample," nUMI"), line=list(color="#000000")) %>% layout(autosize = F, width = 700, height = 350, xaxis = list(title = "Cells in decreasing order by genic UMI count"), yaxis= list(title = "Log10(Genic UMI count)"))
  if(! is.na(kneedle_cumfrac_knee)){
    log10_plot <- add_segments(log10_plot,x=kneedle_cumfrac_knee, xend =kneedle_cumfrac_knee, y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("Kneedle (Cumulative Fraction) Knee (",round(kneedle_cumfrac_knee,digits=1),")"), text = "Kneedle (Cumulative Fraction) Knee", line=list(color="#E69F00"))
  }
  if(! is.na(kneedle_log10_knee)){
    log10_plot <- add_segments(log10_plot,x=kneedle_log10_knee, xend = kneedle_log10_knee,y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("Kneedle (Log10) Knee (",round(kneedle_log10_knee,digits=1),")"), text = "Kneedle (Log10) Knee", line=list(color="#56B4E9"))
  }
  if(! is.na(second_deriv_min_knee)){
    log10_plot <- add_segments(log10_plot, x=second_deriv_min_knee, xend = second_deriv_min_knee, y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("Second Derivative Knee (", round(second_deriv_min_knee,digits=1),")"), text = "Second Derivative Knee", line=list(color="#009E73"))
  }
  #if(! is.na(DropletUtils_knee)){
  #  log10_plot <- add_segments(log10_plot,x=DropletUtils_knee, xend = DropletUtils_knee,y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("DropletUtils Knee (",round(DropletUtils_knee,digits=1), ")"), text = "DropletUtils Knee")
  #}
  if(! is.na(DropletUtils_inflection)){
    log10_plot <- add_segments(log10_plot,x=DropletUtils_inflection, xend = DropletUtils_inflection,y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("DropletUtils (Inflection) Knee (",round(DropletUtils_inflection,digits=1),")"), text = "DropletUtils (Inflection) Knee", line=list(color="#F0E442"))
  }
  if(! is.na(emptydrops_num_cells)){
    log10_plot <- add_segments(log10_plot,x=emptydrops_num_cells, xend = emptydrops_num_cells, y=min(log10numi_frame$`Log10 nUMI`), yend=max(log10numi_frame$`Log10 nUMI`), name=paste0("DropletUtils (EmptyDrops) Knee (",round(emptydrops_num_cells,digits=1),")"), text = "DropletUtils (EmptyDrops) Knee", line=list(color="#0072B2"))
  }

Currently I am calling this when I get the error:

subplot(log10_plot, cum_frac_plot)

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 issue 中的 R 代码和 subplot(log10_plot, cum_frac_plot) 调用开始;检查 subplot 如何组合这些 plotly 对象,包括 add_segments 调用。重现列出的警告,并验证结果是否能在没有无效 layout 属性的情况下将两个图并排渲染。

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

评估

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

把新 issue 发到你的邮箱

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