Skip to content

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

Open
@vttrifonov

Description

@vttrifonov

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions