Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autoresizing behaviour #1041

Closed
dhirschfeld opened this issue Jun 27, 2018 · 6 comments
Closed

autoresizing behaviour #1041

dhirschfeld opened this issue Jun 27, 2018 · 6 comments

Comments

@dhirschfeld
Copy link

As mentioned in #942 (comment), in the JupyterLab display, in a lot of cases, it would be very nice if the plot would automatically resize when the window/tab resized.

Since there are situations where this wouldn't be desirable e.g. in the case of large/slow plots, it would be very good if this behaviour could be chosen by the user with an autoresize property/argument/config

@jonmmease
Copy link
Contributor

Alright, I just pushed out plotlywidget@0.1.1 and plotly==3.0.0rc10 and I added responsive resizing in JupyterLab (the classic notebook doesn't seem to share the same PhosphorJS resize event).

The intended behavior is for plots to expand to fill their container on construction, and when the container is resized. But, if the figure has layout.width or layout.height specified explicitly then no resizing takes place.

I think this is a nice balance. Figure's will resize unless you say what size you want. For plots that are expensive to resize, the user just needs to decide what size they want and it will stick there.

Give it a try and see what you think

@jonmmease
Copy link
Contributor

I think what you were talking about here was included in 3.0.0. Can you confirm @dhirschfeld?

@jonmmease
Copy link
Contributor

Going to close this, as I believe it was sufficiently addressed prior to the release of version 3.0.0. We can reopen or create a new issue if there are any other outstanding issues.

@dhirschfeld
Copy link
Author

Sorry, other priorities got in the way of testing this.

I'm now using plotly 3.1.0 with jupyterlab 0.33.7 and the plot is now automatically resizing which is great!

If I specify the height of the figure the auto-resizing no longer happens - as you mentioned above. I think it would be nice though if only the height is specified for the width to continue to automatically resize and vice-versa. i.e. auto-resizing would only be completely disabled if both height and width were specified.

Not sure if that's feasible?

@jonmmease
Copy link
Contributor

Thanks for the suggestion @dhirschfeld. The width resizing with fixed height is being implemented in #1117

@slishak
Copy link

slishak commented Apr 30, 2019

I'm getting a similar issue to this in jupyterlab with Plotly Express. If I use plotly_graph_objs.FigureWidget setting fixed height but no width, the width scales as expected but the height does not. However, if I use plotly_express.scatter, the height argument is not respected and it auto-resizes both the width and the height.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants