JuliaPlots / JuliaPlots/PlotlyJS.jl
Plot window does not scale to fit plot size
- Dominant language
- Julia
- Stars
- 444
- Forks
- 86
- PR merge metrics
- No merged PRs in 30d
Description
I think it would be nice if the plot window resized itself to fit the plot contents when the plot is first displayed. It seems that right now, the behavior is the inverse, which makes the `size` parameter to `plot()` have no effect when using `PlotlyJS` directly.
When using `Plots` with the `PlotlyJS` backend, the window size is independent of the size of the plot content. For anyone creating large figures, this means that the user has to continually adjust the window size every time a new plot is created in order to be able to see the contents, which can get tedious.
Both issues could be addressed by modifying ` display_blink()` to request a window with a specific size--perhaps something like this:
```
function display_blink(p::SyncPlot)
sizeBuffer = 1.15
plotSize = size(p.plot)
windowOptions = Dict("width"=>floor(Int,plotSize[1]*sizeBuffer), "height"=>floor(Int,plotSize[2]*sizeBuffer))
p.window = Blink.Window(windowOptions)
Blink.body!(p.window, p.scope)
end
```
This is working well for me, but I'm not very familiar with `PlotlyJS`'s code, and I don't know if there's a better way to do it.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.