none commited on
Commit
a75487d
1 Parent(s): 63c6e06

Delete the last plot

Browse files
Files changed (1) hide show
  1. app.py +39 -21
app.py CHANGED
@@ -234,6 +234,8 @@ def build_donut_plot():
234
 
235
  return fig
236
 
 
 
237
 
238
  def main():
239
  # load the data
@@ -407,40 +409,56 @@ Later on,
407
  got me out of a jam.
408
  This `empet` character is pretty much the only one who answers Python posts on Plotly's forums.
409
  As far as I can tell, that's because they're the only person in the world who understands Plotly's Python library.
410
- """)
411
 
412
- st.markdown('## Check out the data!')
413
- st.markdown("""
414
- This plot is similar to the plot above, but the slider here coordinates with a table of the data I extracted to plot each tree.
415
  """)
416
 
 
 
 
 
417
  # This works the way I want
418
  # but the plot is tiny
419
  # also it recalcualtes all of the plots
420
  # every time the slider value changes
 
 
 
 
421
  #
422
  # I tried to cache the plots but build_plot() takes
423
  # a DataFrame which is mutable and therefore unhashable I guess
424
  # so it won't let me cache that function
425
  # I could pack the dataframe bytes to smuggle them past that check
426
  # but whatever
427
- idx = st.slider(
428
- label='Which tree do you want to see?',
429
- min_value=0,
430
- max_value=len(figures)-1,
431
- value=0,
432
- step=1
433
- )
434
- st.markdown(f'### Tree {idx}')
435
- st.plotly_chart(figures[idx])
436
- st.dataframe(trees[idx])
437
- st.markdown("""
438
- This section is mostly just to warn you against making the same foolhardy decision to marry the innermost guts of SciKit-Learn to the sparsely documented world of Plotly animations in Python.
439
-
440
- I'm glad it was challenging, though.
441
- I did go into this hoping for something more interesting than a donut plot.
442
- Maybe I'll think on the `value` and `gain` fields a bit and come up with a version 2.
443
- """)
 
 
 
 
 
 
 
 
 
444
 
445
 
446
 
 
234
 
235
  return fig
236
 
237
+ #def build_figures_cached(graph_objs):
238
+ #return [go.Figure(
239
 
240
  def main():
241
  # load the data
 
409
  got me out of a jam.
410
  This `empet` character is pretty much the only one who answers Python posts on Plotly's forums.
411
  As far as I can tell, that's because they're the only person in the world who understands Plotly's Python library.
 
412
 
413
+ I'm glad it was challenging, though.
414
+ I did go into this hoping for something more interesting than a donut plot.
415
+ Maybe I'll think on the `value` and `gain` fields a bit and come up with a version 2.
416
  """)
417
 
418
+ #st.markdown("""
419
+ #This plot is similar to the plot above, but the slider here coordinates with a table of the data I extracted to plot each tree.
420
+ #""")
421
+
422
  # This works the way I want
423
  # but the plot is tiny
424
  # also it recalcualtes all of the plots
425
  # every time the slider value changes
426
+ #
427
+ # This seems to be affecting the animation too
428
+ # so I'm going to leave it out
429
+ # It's the largest this by far in the flame graph
430
  #
431
  # I tried to cache the plots but build_plot() takes
432
  # a DataFrame which is mutable and therefore unhashable I guess
433
  # so it won't let me cache that function
434
  # I could pack the dataframe bytes to smuggle them past that check
435
  # but whatever
436
+ #idx = st.slider(
437
+ #label='Which tree do you want to see?',
438
+ #min_value=0,
439
+ #max_value=len(figures)-1,
440
+ #value=0,
441
+ #step=1
442
+ #)
443
+ #st.markdown(f'### Tree {idx}')
444
+ #st.plotly_chart(figures[idx])
445
+ #st.dataframe(trees[idx])
446
+ #st.markdown("""
447
+ #This section is mostly just to warn you against making the same foolhardy decision to marry the innermost guts of SciKit-Learn to the sparsely documented world of Plotly animations in Python.
448
+ #
449
+ #""")
450
+
451
+ # This is still super slow even if it's only showing the dataframes
452
+ # I'm just going to leave it out entirely
453
+ #st.markdown('## Check out the data!')
454
+ #idx = st.slider(
455
+ #label='Which tree do you want to see?',
456
+ #min_value=0,
457
+ #max_value=len(figures)-1,
458
+ #value=0,
459
+ #step=1,
460
+ #)
461
+ #st.dataframe(trees[idx])
462
 
463
 
464