I’d like to draw a plot with twin axis, where one is categorical and the other is numerical.
I tried the following code but it throws an error.
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”]
y2=[1,10,4,8]
p = figure(x_axis_type=‘datetime’, y_range=FactorRange(factors=list(set(y))), plot_width=400, plot_height=200)
p.circle(x, y, size=10, color=“blue”)
#p.vbar(x=x, bottom=0, top=y, width=0.1, color=“blue”)
p.extra_y_ranges={‘count’: Range1d(start=0, end=11)}
p.circle(x, y, size=10, color=“red”, y_range_name=‘count’)
p.add_layout(LinearAxis(y_range_name=“count”), ‘right’)
show(p)
···
Here is error message:
E-1009 (INCOMPATIBLE_SCALE_AND_RANGE): A Scale is incompatible with one or more ranges on the same plot dimension: incompatibility on y-dimension: Range1d(id=‘79319bcd-f740-4aa3-8358-b153158d7436’, …), CategoricalScale(id=‘83e32163-4bf9-494c-973a-a63a00b57549’, …) [Figure(id=‘e542157c-8d8e-4b65-b0df-ab1e4c2a69f8’, …)]
W-1005 (SNAPPED_TOOLBAR_ANNOTATIONS): Snapped toolbars and annotations on the same side MAY overlap visually: Figure(id=‘e542157c-8d8e-4b65-b0df-ab1e4c2a69f8’, …)
Javascript error adding output!
Error: Range Range1d is incompatible is Scale CategoricalScale
See your browser Javascript console for more details.
Could someone share a solution?

