Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,8 @@ import pandas as pd
|
|
| 3 |
import pandas_bokeh
|
| 4 |
import matplotlib.pyplot as plt,mpld3
|
| 5 |
import seaborn as sns
|
|
|
|
|
|
|
| 6 |
from highcharts import Highchart
|
| 7 |
from pyecharts.charts import Bar
|
| 8 |
import cufflinks as cf
|
|
@@ -35,8 +37,11 @@ def pd_bokeh():
|
|
| 35 |
pandas_bokeh.output_file("test.html")
|
| 36 |
df=pd.DataFrame({'班级':['天','地','玄','黄'],'姓名':['诸葛清明','公孙轩辕','李耳','石破天'],'成绩':[66,78,99,85]})
|
| 37 |
tt=df.plot_bokeh.bar(x='姓名',y='成绩',ylabel="群员吹水战绩",title="吹牛逼你们是认真的",alpha=0.6,figsize=(600,300),show_figure=False,legend="bottom_right")
|
| 38 |
-
pandas_bokeh.save(tt)
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
| 40 |
def pyecharts1():
|
| 41 |
bar = Bar()
|
| 42 |
bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
|
|
@@ -88,7 +93,7 @@ with demo:
|
|
| 88 |
plotly_button.click(pd_plotly, inputs=[], outputs=plotly_output,api_name='pd_plotly')
|
| 89 |
with gr.TabItem("pd_bokeh"):
|
| 90 |
bokeh_button=gr.Button("pd_bokeh>>")
|
| 91 |
-
bokeh_output=gr.File(label="bokeh_chart")
|
| 92 |
bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output,api_name='pd_bokeh')
|
| 93 |
with gr.TabItem("pyecharts"):
|
| 94 |
ehc_button=gr.Button("pyecharts>>")
|
|
|
|
| 3 |
import pandas_bokeh
|
| 4 |
import matplotlib.pyplot as plt,mpld3
|
| 5 |
import seaborn as sns
|
| 6 |
+
import bokeh.plotting as bk
|
| 7 |
+
from bokeh.embed import json_item
|
| 8 |
from highcharts import Highchart
|
| 9 |
from pyecharts.charts import Bar
|
| 10 |
import cufflinks as cf
|
|
|
|
| 37 |
pandas_bokeh.output_file("test.html")
|
| 38 |
df=pd.DataFrame({'班级':['天','地','玄','黄'],'姓名':['诸葛清明','公孙轩辕','李耳','石破天'],'成绩':[66,78,99,85]})
|
| 39 |
tt=df.plot_bokeh.bar(x='姓名',y='成绩',ylabel="群员吹水战绩",title="吹牛逼你们是认真的",alpha=0.6,figsize=(600,300),show_figure=False,legend="bottom_right")
|
| 40 |
+
pandas_bokeh.save(tt)
|
| 41 |
+
p = bk.figure(plot_width=400,plot_height=400)
|
| 42 |
+
p.patch([1,2,3,4,5],[6,7,8,7,3],alpha=0.5,line_width=2)
|
| 43 |
+
item_text = json_item(p, "plotDiv")
|
| 44 |
+
return 'test.html',item_text
|
| 45 |
def pyecharts1():
|
| 46 |
bar = Bar()
|
| 47 |
bar.add_xaxis(["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"])
|
|
|
|
| 93 |
plotly_button.click(pd_plotly, inputs=[], outputs=plotly_output,api_name='pd_plotly')
|
| 94 |
with gr.TabItem("pd_bokeh"):
|
| 95 |
bokeh_button=gr.Button("pd_bokeh>>")
|
| 96 |
+
bokeh_output=[gr.File(label="bokeh_chart"),gr.Plot(label="bokeh_chart2")]
|
| 97 |
bokeh_button.click(pd_bokeh, inputs=[], outputs=bokeh_output,api_name='pd_bokeh')
|
| 98 |
with gr.TabItem("pyecharts"):
|
| 99 |
ehc_button=gr.Button("pyecharts>>")
|