Multichem commited on
Commit
dca2684
·
verified ·
1 Parent(s): 36501be

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -3
app.py CHANGED
@@ -626,7 +626,7 @@ with tab2:
626
 
627
  with tab3:
628
  st.info(t_stamp)
629
- st.info("Note when creating graphs with multiple stats: The y-axis will be locked to values of the first stat you choose, so to maximize the use of the graphs you'll want to make sure that you are using compatible stats. I.E. use percentages together like GB% and FB% or average based stats like AVG and BABIP")
630
  col1, col2 = st.columns([1, 9])
631
  with col1:
632
  if st.button("Reset Data", key='reset3'):
@@ -704,7 +704,7 @@ with tab3:
704
 
705
  if plot_count == "One":
706
  graph_data = working_data.reindex(['Date', plot_var1],axis="columns")
707
- fig, ax1 = plt.subplots(figsize=(10, 5), layout='tight')
708
 
709
  color = 'tab:blue'
710
  ax1.set_xlabel('Date')
@@ -717,7 +717,7 @@ with tab3:
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=(10, 5), layout='tight')
721
 
722
  color = 'tab:blue'
723
  ax1.set_xlabel('Date')
@@ -732,6 +732,27 @@ with tab3:
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)
 
626
 
627
  with tab3:
628
  st.info(t_stamp)
629
+ st.info("Note when creating graphs with multiple stats: The LEFT y-axis will be locked to values of the first stat you choose, while the RIGHT y-axis will be locked to the values of the second or third stat you chose depending on wether you are viewing Two or Three stats. So, to maximize the use of the graphs, you'll want to make sure that you are using compatible stats. I.E. use percentages together like GB% and FB% or average based stats like AVG and BABIP")
630
  col1, col2 = st.columns([1, 9])
631
  with col1:
632
  if st.button("Reset Data", key='reset3'):
 
704
 
705
  if plot_count == "One":
706
  graph_data = working_data.reindex(['Date', plot_var1],axis="columns")
707
+ fig, ax1 = plt.subplots(figsize=(15, 5), layout='tight')
708
 
709
  color = 'tab:blue'
710
  ax1.set_xlabel('Date')
 
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=(15, 5), layout='tight')
721
 
722
  color = 'tab:blue'
723
  ax1.set_xlabel('Date')
 
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)
738
+ elif plot_count == "Three":
739
+ graph_data = working_data.reindex(['Date', plot_var1, plot_var2, plot_var3],axis="columns")
740
+ fig, ax1 = plt.subplots(figsize=(15, 5), layout='tight')
741
+
742
+ color = 'tab:blue'
743
+ ax1.set_xlabel('Date')
744
+ ax1.set_ylabel(str(plot_var1 + "/" + plot_var2), color = color)
745
+ ax1.plot(graph_data['Date'], graph_data[plot_var1], color = color)
746
+ ax1.plot(graph_data['Date'], graph_data[plot_var2], color = color)
747
+ ax1.tick_params(axis ='y', labelcolor = color)
748
+
749
+ ax2 = ax1.twinx()
750
+
751
+ color = 'tab:green'
752
+ ax2.set_ylabel(plot_var3, color = color)
753
+ ax2.plot(graph_data['Date'], graph_data[plot_var3], color = color)
754
+ ax2.tick_params(axis ='y', labelcolor = color)
755
+
756
  buf = BytesIO()
757
  fig.savefig(buf, format="png")
758
  st.image(buf)