changxin commited on
Commit
71f7697
·
1 Parent(s): e54ea57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -17,6 +17,13 @@ def pd_plotly():
17
  df = pd.DataFrame({'课程':['语文', '数学', '英语'], '成绩':[66, 98, 78]})
18
  ax = df.plot.bar(x='课程',y='成绩')
19
  return ax #plt
 
 
 
 
 
 
 
20
  demo=gr.Blocks()
21
  with demo:
22
  gr.Markdown("# <center>图表渲染测试")
@@ -33,6 +40,10 @@ with demo:
33
  plotly_button=gr.Button("pd_plotly>>")
34
  plotly_output=gr.Plot(label="plotly_chart")
35
  plotly_button.click(pd_plotly, inputs=[], outputs=plotly_output)
 
 
 
 
36
 
37
 
38
  with gr.TabItem("echarts"):
 
17
  df = pd.DataFrame({'课程':['语文', '数学', '英语'], '成绩':[66, 98, 78]})
18
  ax = df.plot.bar(x='课程',y='成绩')
19
  return ax #plt
20
+ def pd_bokeh():
21
+ pd.options.plotting.backend='pandas_bokeh'
22
+ import pandas_bokeh
23
+ from bokeh.plotting import figure,show
24
+ df = pd.DataFrame({'课程':['语文', '数学', '英语'], '成绩':[66, 98, 78]})
25
+ ax = df['成绩'].plot_bokeh.pie()
26
+ return ax #plt
27
  demo=gr.Blocks()
28
  with demo:
29
  gr.Markdown("# <center>图表渲染测试")
 
40
  plotly_button=gr.Button("pd_plotly>>")
41
  plotly_output=gr.Plot(label="plotly_chart")
42
  plotly_button.click(pd_plotly, inputs=[], outputs=plotly_output)
43
+ with gr.TabItem("pd_bokeh"):
44
+ bokeh_button=gr.Button("pd_bokeh>>")
45
+ bokeh_output=gr.Plot(label="plotly_chart")
46
+ bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output)
47
 
48
 
49
  with gr.TabItem("echarts"):