Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

199
Views
¿Cómo puedo cambiar el tamaño de mi gráfico con el ancho/largo de la ventana de mi navegador?

Quiero cambiar automáticamente el tamaño de mi gráfico plotly cuando cambia el tamaño de la ventana del navegador. Algo así como {responsive: true} o style="width:100%; . Mi código Python (Flask) es así:

 app = Flask(__name__) @app.route('/') def notdash(): df = pd.DataFrame({ 'Fruit': ['Apples', 'Oranges', 'Bananas', 'Apples', 'Oranges', Bananas'], 'Amount': [4, 1, 2, 2, 4, 5], 'City': ['SF', 'SF', 'SF', 'Montreal', 'Montreal', 'Montreal'] }) fig = px.bar(df, x='Fruit', y='Amount', color='City', barmode='group') graphJSON = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder) return render_template('notdash.html', graphJSON=graphJSON)

Y para el JS :

 <!doctype html> <html> <body> <h1>Plotly chart</h1> <div id='chart' class='chart'”></div> </body> <script src='https://cdn.plot.ly/plotly-latest.min.js'></script> <script type='text/javascript'> var graphs = {{graphJSON | safe}}; Plotly.plot('chart',graphs,{}); </script> </html>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!