joshdavham commited on
Commit
36b4cf7
·
1 Parent(s): 9df6180

data visualizations get white background

Browse files
Files changed (1) hide show
  1. app.py +29 -8
app.py CHANGED
@@ -192,9 +192,9 @@ def get_wpm_chart(show_medians=False):
192
 
193
 
194
  if show_medians:
195
- layered_chart = alt.layer(histogram, vertical_lines, text_labels, background='#f6f8fb')
196
  else:
197
- layered_chart = alt.layer(histogram, background='#f6f8fb')
198
 
199
  return layered_chart
200
 
@@ -300,6 +300,8 @@ def get_wpm_vs_sps_chart(interactive=False):
300
  ).add_params(
301
  selection,
302
  highlight
 
 
303
  )
304
 
305
  # Display the plot
@@ -529,7 +531,7 @@ def get_word_coverage_chart():
529
  )
530
 
531
  #layered_chart = alt.layer(line_chart, background='#f6f8fb')
532
- layered_chart = alt.layer(line_chart, vertical_lines, text_labels, background='#f6f8fb')
533
 
534
  return layered_chart
535
 
@@ -681,7 +683,7 @@ def get_zoomed_word_coverage_chart():
681
  )
682
 
683
  #layered_chart = alt.layer(line_chart, background='#f6f8fb')
684
- layered_chart = alt.layer(line_chart, vertical_lines, text_labels, background='#f6f8fb')
685
 
686
  return layered_chart
687
 
@@ -764,10 +766,27 @@ styled_df = df.style.set_table_styles(
764
  {'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]},
765
  {'selector': 'td:hover', 'props': [('background-color', '#e0f7fa')]}
766
  ],
767
- }).format("{:.2%}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
768
 
769
  # Display the styled DataFrame
770
- st.markdown(styled_df.to_html(), unsafe_allow_html=True)
 
 
771
 
772
  st.markdown("## What type of word")
773
 
@@ -816,10 +835,12 @@ styled_df = df.style.set_table_styles(
816
  {'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]},
817
  {'selector': 'td:hover', 'props': [('background-color', '#e0f7fa')]}
818
  ],
819
- }).format("{:.2%}")
820
 
821
  # Display the styled DataFrame
822
- st.markdown(styled_df.to_html(), unsafe_allow_html=True)
 
 
823
 
824
  # heatmap
825
 
 
192
 
193
 
194
  if show_medians:
195
+ layered_chart = alt.layer(histogram, vertical_lines, text_labels, background='white')
196
  else:
197
+ layered_chart = alt.layer(histogram, background='white')
198
 
199
  return layered_chart
200
 
 
300
  ).add_params(
301
  selection,
302
  highlight
303
+ ).configure(
304
+ background='white'
305
  )
306
 
307
  # Display the plot
 
531
  )
532
 
533
  #layered_chart = alt.layer(line_chart, background='#f6f8fb')
534
+ layered_chart = alt.layer(line_chart, vertical_lines, text_labels, background='white')
535
 
536
  return layered_chart
537
 
 
683
  )
684
 
685
  #layered_chart = alt.layer(line_chart, background='#f6f8fb')
686
+ layered_chart = alt.layer(line_chart, vertical_lines, text_labels, background='white')
687
 
688
  return layered_chart
689
 
 
766
  {'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]},
767
  {'selector': 'td:hover', 'props': [('background-color', '#e0f7fa')]}
768
  ],
769
+ # This is where we target the top-left index column reader
770
+ '': [
771
+ {'selector': '.index_name', 'props': [('color', 'green'), ('font-weight', 'bold')]}
772
+ ]
773
+ }).set_properties(**{'background-color': 'white'}).format("{:.2%}")
774
+
775
+ # Inject CSS to ensure the background is white in the markdown section
776
+ st.markdown(
777
+ """
778
+ <style>
779
+ .dataframe-divv {
780
+ background-color: white;
781
+ }
782
+ </style>
783
+ """, unsafe_allow_html=True
784
+ )
785
 
786
  # Display the styled DataFrame
787
+ st.markdown(
788
+ '<div class="dataframe-divv">' + styled_df.to_html() + "</div>"
789
+ , unsafe_allow_html=True)
790
 
791
  st.markdown("## What type of word")
792
 
 
835
  {'selector': 'th.col_heading.level0', 'props': [('background-color', 'rgba(221, 158, 158, 0.45)')]},
836
  {'selector': 'td:hover', 'props': [('background-color', '#e0f7fa')]}
837
  ],
838
+ }).set_properties(**{'background-color': 'white'}).format("{:.2%}")
839
 
840
  # Display the styled DataFrame
841
+ st.markdown(
842
+ '<div class="dataframe-divv">' + styled_df.to_html() + "</div>"
843
+ , unsafe_allow_html=True)
844
 
845
  # heatmap
846