Multichem commited on
Commit
2334a98
·
verified ·
1 Parent(s): 8400795

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -11,6 +11,7 @@ import streamlit as st
11
  import gspread
12
  import pymongo
13
  import time
 
14
  from pymongo.mongo_client import MongoClient
15
  import matplotlib.pyplot as plt
16
  import certifi
@@ -711,7 +712,9 @@ with tab3:
711
  ax1.plot(graph_data['Date'], graph_data[plot_var1], color = color)
712
  ax1.tick_params(axis ='y', labelcolor = color)
713
 
714
- st.pyplot(fig)
 
 
715
  elif plot_count == "Two":
716
  graph_data = working_data.reindex(['Date', plot_var1, plot_var2],axis="columns")
717
  fig, ax1 = plt.subplots(figsize=(5, 5), layout='tight')
@@ -729,4 +732,6 @@ with tab3:
729
  ax2.plot(graph_data['Date'], graph_data[plot_var2], color = color)
730
  ax2.tick_params(axis ='y', labelcolor = color)
731
 
732
- st.pyplot(fig)
 
 
 
11
  import gspread
12
  import pymongo
13
  import time
14
+ from io import BytesIO
15
  from pymongo.mongo_client import MongoClient
16
  import matplotlib.pyplot as plt
17
  import certifi
 
712
  ax1.plot(graph_data['Date'], graph_data[plot_var1], color = color)
713
  ax1.tick_params(axis ='y', labelcolor = color)
714
 
715
+ buf = BytesIO()
716
+ fig.savefig(buf, format="png")
717
+ st.image(buf)
718
  elif plot_count == "Two":
719
  graph_data = working_data.reindex(['Date', plot_var1, plot_var2],axis="columns")
720
  fig, ax1 = plt.subplots(figsize=(5, 5), layout='tight')
 
732
  ax2.plot(graph_data['Date'], graph_data[plot_var2], color = color)
733
  ax2.tick_params(axis ='y', labelcolor = color)
734
 
735
+ buf = BytesIO()
736
+ fig.savefig(buf, format="png")
737
+ st.image(buf)