使用散景图时,我发现以下问题:
1)该图不会立即显示点。
2)当我使用鼠标滚轮缩小3倍时,这些点变得可见。
3)当我缩小7倍时,点将移至下一分钟/上一分钟(在我的情况下,原本是经过7倍缩放,它们之间的距离在40m:54s和41m之间,它们到达40:38至40:44)
我尝试设置 g.x_range.range_padding = 0.1 到0,没有运气
import pandas as pd
import bokeh
from bokeh.plotting import *
from bokeh.io import output_file,show,save
from bokeh.resources import CDN,INLINE
from bokeh.embed import file_html
from bokeh.models.ranges import *
from bokeh.palettes import Spectral6
from bokeh.transform import factor_cmap
from bokeh.transform import dodge
from bokeh.core.properties import value
from bokeh.embed import components
from bokeh.layouts import row,column
from bokeh.models import DatetimeTickFormatter
myPandas = pd.read_pickle("myPanda.pickle")
source=ColumnDataSource(data=myPandas)
yaxis="yaxis"
xaxis="xaxis"
def getTitle(graphDet):
return graphDet
graphDet="Dummy"
g = figure(plot_width=450, plot_height=300, y_axis_label=yaxis, x_axis_label=xaxis, output_backend="webgl", title=getTitle(graphDet), x_axis_type="datetime")
x="time"
y="col1"
g.circle(myPandas[x],myPandas[y], size=5,legend=value(y))
g.xaxis[0].formatter=DatetimeTickFormatter(milliseconds = ['%3Nms']
,seconds = ['%Ss']
)
g.x_range.range_padding = 0.1
g.xgrid.grid_line_color = None
g.legend.location = "top_right"
g.legend.orientation = "vertical"
show(g)
可在以下位置找到用于输入的泡菜文件 https://www.dropbox.com/s/4fe11kdu00nbcjp/myPanda.pickle?dl=0
我的期望是该情节必须从一开始就可见,并且不能随时间变化。
答案 0 :(得分:0)
看起来像是使用webgl
引入的错误。删除它可以解决问题,但是您可以接受吗? (在bokeh v1.0.4上测试)
import pandas as pd
import bokeh
import numpy as np
from bokeh.plotting import *
from bokeh.io import output_file, show, save
from bokeh.resources import CDN, INLINE
from bokeh.embed import file_html
from bokeh.models.ranges import *
from bokeh.palettes import Spectral6
from bokeh.transform import factor_cmap
from bokeh.transform import dodge
from bokeh.core.properties import value
from bokeh.embed import components
from bokeh.layouts import row, column
from bokeh.models import DatetimeTickFormatter
from datetime import datetime, timedelta
d_start = datetime(2016, 6, 1)
d_step = timedelta(milliseconds = 100)
t = [d_start + (i * d_step) for i in range(0, 100)]
myPandas = pd.DataFrame(columns = ['time', 'col1'], data = {'time': t, 'col1': np.arange(100)}, index = t)
source = ColumnDataSource(data = myPandas)
def getTitle(graphDet):
return graphDet
graphDet = "Dummy"
g = figure(plot_width = 450, plot_height = 300, y_axis_label = "yaxis", x_axis_label = "xaxis", title = getTitle(graphDet), x_axis_type = "datetime")
x = "time"
y = "col1"
g.circle(myPandas[x], myPandas[y], size = 5, legend = value(y))
g.xaxis[0].formatter = DatetimeTickFormatter(seconds = ['%Ss'], milliseconds = ['%3Nms'])
g.x_range.range_padding = 0.1
g.xgrid.grid_line_color = None
g.legend.location = "top_right"
g.legend.orientation = "vertical"
show(g)