Black Lives Matter. Please consider donating to Black Girls Code today.
Learn how to use COVID-19 data in open source Dash apps. Register for the Sept 23rd webinar with IQT!

Plot Not Resizing

I am plotting graphs offline . I am using following function to plot graph offline . I am using flask for backend and sending data from flask to front end using JSON . Following is my code .

from plotly.offline import plot

    my_plot_div=plot(fig, output_type='div')
      return render_template('index.html',
                                   div_placeholder= Markup(my_plot_div)

However my graph doesnot resizes as I resize my window . How can I improve ?

You’ll have to write a little of javascript (unfortunately) to get a responsive graph.

Here’s how:

etienne, what about if you are using the python module. The graph doesn’t get made within the script. How would you pass the gd variable from the script out to use in the python chart creation code: (“myChart = plotly.offline.plot({…”)? Also, does the autosize attribute size the chart based on its content, or the container it is passed to?

@YungGubba That would be a nice addition the

You can write up a new issue here to tell the maintainers.