plotly / plotly/plotly.R

[Feature request]: change height sizing policy of plotly htmlwidget to 100%

Aperta
#1,567 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

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

Descrizione

Can we change the default widget height sizing policy set in as_widget to 100%. Right now it is 400px and this makes it hard to make a plot to fill its container along the height.

For example, I am hoping to use the following simplified example to change my plot to height 5in. It does not work (for me), because the style of the resulting htmlwidget is set to the default "400px"

tags$div(style="width: 100%; height: 5in", 
  plot_ly(x=1, y=1, type="scatter", mode="markers")
)

The following on the other hand does the job.

tags$div(style="width: 100%; height: 5in", 
   plot_ly(x=1, y=1, type="scatter", mode="markers") %T>% {
     .$sizingPolicy$defaultHeight<-"100%"
 }
)

It seems to me that a default height of "100%", like the default for width, makes more sense (allowing for the container to control the size) than the arbitrary "400px" used right now.

I really would like to control the height of my plots in a R markdown html document and this was the only solution I could come up with: R plotly seems to deal fine with "px" units, but setting inches and % did not work. Perhaps I am missing something...

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 dal punto di ingresso as_widget e verifica come viene assegnata l’altezza della sizingPolicy predefinita. Riproduci l’esempio tags$div con un contenitore di 5in, quindi verifica che il widget utilizzi l’altezza del contenitore quando l’altezza predefinita è 100%.

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

Valutazione

Stack tecnologico
r
Ambito
data-visualization
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
48/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.