title: How to insert a Python Plotted Graph to HTML file?
body: <p>I had been searching for ways to do this but I seem couldn't get any helpful answer online thus I have to directly ask here.</p>
  
  <p>What I want is simple: Process some data from CSV, plot it into graph and post it to my HTML. I do not own any web-domain, the HTML is put in a shared drive and could be view by a certain allowed crowd using Chrome.</p>
  
  <p>Here is my python code snippet:</p>
  
  <pre><code>import pandas as pd
  import numpy as np
  import matplotlib.pyplot as plt
  from jinja2 import Environment, FileSystemLoader
  import plotly as py
  import numpy as np
  import plotly.tools as plotly_tools
  import plotly.plotly as py
  from plotly.graph_objs import *
  
  def dashboard_plot_graph():
      html_template = __Html_path__.get_template("PublishPG.html")
      curr_mcl_res = pd.read_csv(os.path.join(__Result_path__, __Chart_csv__))
      print curr_mcl_res.head()
      x = curr_mcl_res['TestSuite']
      my_plot = curr_mcl_res.plot(x, kind='bar', stacked=True, title='Latest Trend')
      fig = my_plot.get_figure()
      fig.savefig("./my_img.png")
      html_template_vars = {"curr_mcl_div_placeholder": curr_mcl_res.to_html()}
      html_out = html_template.render(html_template_vars)
      f = open ('file.html', 'w')
      f.write( html_out )
      f.close()
      plt.show()
  </code></pre>
  
  <p>Here is my HTML code snippet: </p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  &lt;title&gt; Testing Webpage &lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;h1&gt; Hello World! &lt;/h1&gt;
  &lt;p&gt; This is a test page &lt;/p&gt;
  {{ curr_mcl_div_placeholder }}
  &lt;/body&gt;
  
  &lt;html&gt;
  </code></pre>
  
  <p>This is the plot I wish to see in my webpage:
  <a href="https://i.stack.imgur.com/Fjiao.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fjiao.png" alt="enter image description here"></a></p>
  
  <p>I have tried:</p>
  
  <ol>
  <li>Follow online tutorial which seem to say plotly able to insert the plot to HTML... however it failed... the most I can do is to
  insert the data frame (table) as shown in the code snippet above.</li>
  <li>I tried to think work around such as save the plotted graph as image and try to insert the image to html. But it does not allow to
  take image from local drive for security reason. It only able to
  pull image if I uploaded the image somewhere to the cloud /
  web-domain. But the data is not suitable to be exposed on any social
  media site.</li>
  </ol>
  
  <p>Any suggest for me to get through this limitation?</p>