Plotly.py: Responsive plots

Created on 11 Mar 2016  路  2Comments  路  Source: plotly/plotly.py

Hey guys

I've noticed that when I embed an online plot from plotly into a local html file on my PC, it is responsive and changes beautifully with my browser width. I also noticed the following:

  1. When I generate a plot in Python and save it to file (output_type='file') and afterwards embed the plot into my local html file, the size changes only when I reload my local html file.
  2. When I generate a plot in Python and save it to div (output_type='div') and afterwards embed the plot into my local html file, the size is completely fixed.

Now I am currently embedding the plots with an iframe like this:

<div class="chart-stage">
            <iframe width="100%" height="480px" frameborder="0" scrolling="no" src="https://plot.ly/~jackp/10002.embed"></iframe>
</div>

How can I get the offline plots to be responsive like the online plotly plots that I embed? I'm asking just in case there is already functionality for this that I might have missed. What is the preferred way to get these offline plots to behave like the online plots?

Most helpful comment

Fractally, could you elaborate on how you were able to generate responsive charts with cufflinks?

All 2 comments

Update: My issue was related to cufflinks. By using a custom layout, I could fix the issue I was having.

Fractally, could you elaborate on how you were able to generate responsive charts with cufflinks?

Was this page helpful?
0 / 5 - 0 ratings