plotly / plotly/plotly.R

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

Offen
#1,567 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

wontfix
Vorherrschende Sprache
R
Sterne
2.7k
Forks
641
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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...

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne am as_widget-Einstiegspunkt und untersuche, wie die Höhe der standardmäßigen sizingPolicy zugewiesen wird. Stelle das tags$div-Beispiel mit einem 5in-Container nach und überprüfe anschließend, dass das Widget die Containerhöhe verwendet, wenn die Standardhöhe 100% beträgt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
r
Bereich
data-visualization
Issue-Typ
Feature
Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Aktivitätsstatus
Veraltet
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
48/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.