简体   繁体   English

在Bokeh中使用轴类型日期时间的矩形散点图

[英]Rectangle Scatter Plot with axis type datetime in Bokeh

Rectangle Scatter Plot with axis type datetime in Bokeh 在Bokeh中使用轴类型日期时间的矩形散点图

I would like to create a plot with the x-axis type datetime . 我想用x轴类型的datetime创建一个图。 As an example I used the function scatter with squares and the visual variable size. 作为一个例子,我使用了带有正方形和可视变量大小的函数scatter

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 . 注意:我使用的是Python v.2.7.8Bokeh v.0.7.0

You should be able to set width_units="screen" in the call to rect and then set the width in pixels. 您应该能够在调用rect设置width_units="screen" ,然后设置宽度(以像素为单位)。 Also please note that form of API usage has been deprecated, please consider: 另请注意,API使用形式已被弃用,请考虑:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM