当我更改空心视图中的xticks时,网格线与默认的xticks对齐。如何让网格与我的自定义xticks对齐?
import holoviews as hv
import numpy as np
hv.extension('bokeh')
points = [(0.1*i, np.sin(0.1*i)) for i in range(100)]
%opts Curve [xticks=[0,1.5,9] show_grid=True]
hv.Curve(points)
答案 0 :(得分:1)
如果这仍然相关,你必须将其转换为散景图,然后使用像这样的散景函数。
from bokeh.io import output_notebook, show
from bokeh.models.tickers import FixedTicker
import holoviews as hv
import numpy as np
hv.extension('bokeh')
renderer = hv.renderer('bokeh')
%opts Curve [xticks=[0, 1.5, 9] show_grid=True]
points = [(0.1 * i, np.sin(0.1 * i)) for i in range(100)]
plot = hv.Curve(points)
p = renderer.get_plot(plot).state
p.xgrid[0].ticker=FixedTicker(ticks=[1.5, 9])
show(p)