plotly / plotly/plotly.R

Setting anchor = "free" in R subplot() causes the graph to disappear

Aperta
#1,768 6 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

plotly.js
Lingua principale
R
Stelle
2.7k
Fork
641
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

I'm trying to build a subplot of stacked scatter plots, where there are multiple axes on each scatter plot.

Below is an example of the type of plot. To position the yaxis side-by-side, I have layout(yaxis(anchor = "free")) set am using position to place the axis.

image

All my attempts to set anchor = "free" in subplots left my plot space completely blank. Some testing revealed that even a subplot constructed from a single plot will not display if anchor="free"

Please see below REPREX.

require(plotly)
df <- data.frame(x = 1:10, y = 1:10, y2 = 10:19)
plt <- plot_ly(data = df) %>%
  add_trace(x = ~x, y = ~y,
            mode = "markers", type = "scatter",
            yaxis = "y") %>%
  add_trace(x = ~x, y = ~y2,
            mode = "markers", type = "scatter",
            yaxis = "y2") %>%
  layout(
    xaxis = list(
      domain = c(.12, .88)
    ),
    yaxis = list(
      title = "y_1"
    ),
    yaxis2 = list(
      title = "y_2",
      anchor = "free",
      position = .10,
      overlaying = "y"
    ),
    margin = list(
      pad = 60
    )
  )
subplot(plt)

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo il reprex R fornito con plot_ly(), layout() e subplot() per confermare che anchor = "free" produca un grafico vuoto. Poi traccia il modo in cui subplot() gestisce le impostazioni di yaxis e yaxis2, in particolare anchor, position e overlaying. Il lavoro è completo quando il subplot visualizza le sue tracce preservando l’asse posizionato liberamente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.