Spirou
Spirou

Reputation: 267

Rectangle Scatter Plot with axis type datetime in Bokeh

Rectangle Scatter Plot with axis type datetime in Bokeh

I would like to create a plot with the x-axis type datetime. As an example I used the function scatter with squares and the visual variable size.

import datetime
from bokeh.plotting import *

figure(x_axis_type="datetime")
scatter([d1,d2,d3], [1,5,3], size=[10,20,30], marker="square")
show()

As a second visualization I would replace the square with a rectangle and use the visual variables width and height. Because of the unit division I can not see the width. Is there a solution for this problem (except multiply the width with a factor)? Can I create a new marker?

figure(x_axis_type="datetime")
rect([d1,d2,d3], [1,5,3], [1,2,3], [5,1,2])
show()

NOTE: I'm using Python v.2.7.8 and Bokeh v.0.7.0.

Upvotes: 1

Views: 2647

Answers (1)

bigreddot
bigreddot

Reputation: 34568

You should be able to set width_units="screen" in the call to rect and then set the width in pixels. Also please note that form of API usage has been deprecated, please consider:

p = figure(x_axis_type="datetime")
p.rect([d1,d2,d3], [1,5,3], [1,2,3], [5,1,2])
show(p)

Upvotes: 3

Related Questions