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

Responsive figure with locked aspect ratio #3467

Closed
nicolaskruchten opened this issue Jan 23, 2019 · 4 comments
Closed

Responsive figure with locked aspect ratio #3467

nicolaskruchten opened this issue Jan 23, 2019 · 4 comments
Assignees
Labels
feature something new

Comments

@nicolaskruchten
Copy link
Contributor

Right now if I have a container that's got a constrained width but an unconstrained height (like, say, a Jupyter Notebook output cell ;) then I can make my figure responsive, which will cause it to fill the available width, but then I have to explicitly set the height of the figure. It would be really great to be able to set the desired aspect ratio such that the heigh would depend on the responsive width (and vice versa)

@antoinerg antoinerg self-assigned this Jan 23, 2019
@antoinerg
Copy link
Contributor

antoinerg commented Jan 23, 2019

Thank you @nicolaskruchten for reporting this issue!

The following CSS trick can help with this scenario: https://spin.atomicobject.com/2015/07/14/css-responsive-square/

Here's an example of it in action: https://codepen.io/anon/pen/GzJjKL

Because this CSS trick is subtle, maybe it should it should be managed by plotly.js.

cc @plotly/plotly_js

@antoinerg antoinerg added the feature something new label Jan 23, 2019
@eMaringolo
Copy link

The trick is a good workaround for single plots, but won't work for subplots.

It would be great to be able to display independent subplots using a constrained ratio (or at least unconstrained/square).

@etpinard
Copy link
Contributor

etpinard commented Mar 22, 2019

@eMaringolo

It would be great to be able to display independent subplots using a constrained ratio

You must be looking for:

@gvwilson
Copy link
Contributor

Hi - this issue has been sitting for a while, so as part of our effort to tidy up our public repositories I'm going to close it. If it's still a concern, we'd be grateful if you could open a new issue (with a short reproducible example if appropriate) so that we can add it to our stack. Cheers - @gvwilson

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

No branches or pull requests

5 participants