Ich möchte ein vbar-Diagramm mit Bokeh, wo x-Achse dauert Datum und y-Achse nimmt kategorische Werte.kategorische y-Achse und datetime x-Achse mit Bokeh vbar plot
Anfangs habe ich versucht, Kreis Handlung wie folgt:
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)
Es Ausnahme der Tatsache, sieht gut aus, dass es nicht in bar Form ist.
Als nächstes habe ich versucht, den folgenden Code, aber keine Plots angezeigt:
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)
Aha, ich habe es! Ich danke dir sehr! – Royalblue