小工具Holoview条形图

时间:2018-06-07 07:33:17

标签: python bar-chart bokeh holoviews collection-radio-buttons

我想绘制条形图并放置由3个选项组成的单选按钮。此代码绘制了按公司分组的日期和极性分数(可以有负值和正值)。这看起来真的很混乱。所以我想要RadioButtons,这样当我点击其中一个时,图表就会自行改变。

import holoviews as hv
import pandas as pd
import numpy as np
from bokeh.models import Select
from bokeh.layouts import widgetbox
from bokeh.models import ColumnDataSource
from bokeh.io import output_file, show
from bokeh.plotting import figure

from bokeh.models.widgets import RadioButtonGroup, Panel, Tabs
data=pd.read_csv("C:/Users/Nisarg.Bhatt/Documents/data.csv", engine="python")

train=data.groupby(["versionCreated","Company"])["Polarity Score"].mean()
table=hv.Table(train)


print(table)

bars=hv.Bars(table).opts(plot=dict(width=1500, height=800))
bars

renderer = hv.renderer('bokeh')
app = renderer.app(bars)
print(app)

from bokeh.server.server import Server
server = Server({'/': app}, port=0)
server.start()
server.show('/')

请帮助。先谢谢你 问候, Nisarg

0 个答案:

没有答案