plotly / plotly/plotly.R

Plotly Subplot Function Issue

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

Nobody has claimed this yet.

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

Description

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)

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 with the R code in the issue and the subplot(log10_plot, cum_frac_plot) call; inspect how subplot combines these plotly objects, including the add_segments calls. Reproduce the listed warnings and verify that the result renders both plots side by side without invalid layout attributes.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.