0

在此处输入图像描述

当我更改hollowviews 中的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)
4

1 回答 1

1

嗨,如果这仍然相关,您必须将其转换为 Bokeh 图形,然后使用这样的 Bokeh 功能。

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)

特定刻度位置

于 2018-02-11T00:10:41.490 回答