How do I make the plot take up the full browser window?

I’m using plotly for scientific computing. Typically I would run some analysis and plot the results for investigation. Right now when I create plots that open up in the web browser, they are pretty small. Typically they take up less than 1/4 of the screen space.

Is there any way I can make it so that when the plot opens up in the web browser, that it takes up the full space so that it is as large as possible? This makes it easier to interact with and view the results.

1 Like

Hi @w1res,

What plotting method are you using? In any case, the plot should expand to fill the window as long as no explicit width/height have been set on the figure.

The explicit width/height are set in the fig.layout.width and fig.layout.height properties. You can assing None to these properties to remove them, I’d recommend trying that right before you call plot.

If that doesn’t help, could you add a minimal code example (in a fenced code block https://help.github.com/articles/creating-and-highlighting-code-blocks/) that reproduces what you’re seeing?

Hope that helps!
-Jon

Thanks for the reply. I’m actually using a programming language called Julia (used for scientific computing similar to MATLAB). I didn’t mention it because I thought most people probably don’t know it. It uses a library called Plots that provides a common interface to a variety of plotting backends, and plotly is one of the choices.

I’m still getting started with Julia and Plots, so I will have to figure out if it is possible to change those settings through the interface, or if I will have to use a lower level library to do that.

Hi @w1res,

Thanks for the extra info. The dynamic resizing logic is something that the Plots library would need to include when it outputs the HTML representation. Here’s the logic that plotly.py outputs to make this happen.

I’d recommend checking the issue tracker for the Plots package, and if this hasn’t bee brought up before, open a new feature request issue with a reference to this section of plotly.py’s logic.

Good luck!
-Jon

@jmmease Thanks for that info! I will see about getting something like that implemented. In the meantime, I found that if I use the PlotlyJS.jl julia library directly, that one will output full sized plots inside the Electron window it opens up for plots, so that might give me some insight as well.

1 Like