在散景折线图中,有没有办法根据数据框列设置线条的颜色?我正在尝试以下但它不起作用。如果我使用颜色参数,图表不会显示如下所示。如果我删除它会显示出来。
import pandas as pd
from bokeh.io import show
from bokeh.plotting import figure
from bokeh.models import NumeralTickFormatter, HoverTool
data = pd.read_csv('C:\\Users\\asde\\Desktop\\Python\\bok\\StateNames.csv',thousands=',',index_col='Id')
#data1 = data[(data.Name == 'Mary')& (data.State == 'AZ')]
data.apply(lambda x: pd.to_numeric(x, errors='ignore'))
data2 = data[(data.Year >= 2010) & (data.Year <= 2014)& (data.State == 'AZ')]
data2.head()
p = figure()
#p.line(x=data1['Year'],y=data1['Count'])
p.line(x=data2['Year'],y=data2['Count'],***color = data2['Name']***)
p.xaxis[0].formatter = NumeralTickFormatter(format='0000')
show(p)