0
我想繪製一個虛擬散點圖使用散景,其中x軸採取日期時間和y軸採取分類值。分類y軸和日期時間x軸與散景vbar陰謀
起初我想圓情節如下:
import pandas as pd
from datetime import datetime
from dateutil.parser import parse
from bokeh.plotting import figure, show, output_notebook
from bokeh.models.ranges import FactorRange
x = pd.Series(['2017/1/1', '2017/1/2', '2017/1/3', '2017/1/4']).map(lambda x: parse(x))
y = ["a", "b", "c", "a"]
p = figure(x_axis_type='datetime', y_range=list(set(y)), plot_width=400, plot_height=200)
p.circle(x, y, size=10, line_color="blue", line_width=1)
show(p)
它看起來只是一個事實,即它不是在酒吧的形式很好。
接下來,我嘗試下面的代碼,但沒有顯示地塊:
x = pd.Series(['2017/1/1', '2017/1/2', '2017/1/3', '2017/1/4']).map(lambda x: parse(x))
y = ["a", "b", "c", "a"]
p = figure(x_axis_type='datetime', y_range=list(set(y)), plot_width=400, plot_height=200)
p.vbar(x=x, bottom=0, top=y, width=0.1, color="blue")
show(p)
啊哈,我明白了!非常感謝! – Royalblue