title: Plotly in Python
body: <p>My plotly is not working properly. I am trying to render the graph in html, but it keeps showing the text rather than the graph itself.</p>
  
  <p>Below is an extract of the code written in the 'app.py' file - using the Flask microframework.</p>
  
  <pre><code> k = plotly.offline.plot({
      "data": [go.Scatter(x = money_x, y = result, name = "Expenditure")],
      "layout": go.Layout(title="Expenditure")
  }, auto_open=True, show_link=False, output_type = 'div', include_plotlyjs=False)
  return render_template('plot.html', name=session['name'], surname=session['surname'], k=str(k), sun=session['student_number'])
  </code></pre>
  
  <p>Below is an extract from the html file. In the html, I included an online graphic so as to try and see what was wrong with the code - but that has since returned moot.</p>
  
  <pre><code>&lt;div class="container-fluid"&gt;
    &lt;div class="row text-center"&gt;
      &lt;div class="col-sm-12"&gt;
        &lt;br&gt;
        &lt;h2 class = "display-2"&gt;{{name}} {{surname}}&lt;/h2&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div id="cd52e831-399a-403d-9bb2-0c56214b1d38" style="height: 100%; width: 100%;" class="plotly-graph-div"&gt;&lt;/div&gt;
    &lt;script type="text/javascript"&gt;window.PLOTLYENV=window.PLOTLYENV || {};window.PLOTLYENV.BASE_URL="https://plot.ly";Plotly.newPlot("cd52e831-399a-403d-9bb2-0c56214b1d38", [{"type": "pie", "values": [4500, 2500, 1053, 500], "labels": ["Oxygen", "Hydrogen", "Carbon_Dioxide", "Nitrogen"]}], {}, {"linkText": "Export to plot.ly", "showLink": true})&lt;/script&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-sm-12"&gt;
        &lt;h4 class = "display-4"&gt;Expenditure Plot&lt;/h4&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  {{k}}
  &lt;/div&gt;
  </code></pre>
  
  <p>Below is a picture of the observed output of the program. As one can see, the plotly image that was harnessed from online remained unharmed, while my generated graph does not get translated into plotly content. </p>
  
  <p>Please help</p>
  
  <p>(As best as I know, the relevant Javascript has been included for the project)
  <a href="https://i.stack.imgur.com/p8Wxo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/p8Wxo.png" alt="Image illustrating the output of the Flask microframework and the HTML file that were provided previously"></a></p>