首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hvplot :如何删除默认工具

Hvplot :如何删除默认工具
EN

Stack Overflow用户
提问于 2020-08-05 15:59:56
回答 1查看 106关注 0票数 1

我正在使用HvPlot,它工作得很好,但是我不知道如何删除默认的工具'pan','wheel_zoom‘和'box_zoom’。我的HvPlot代码是:

代码语言:javascript
复制
points = df.hvplot.line(x='x', y='y',
                        grid=True,
                        tools=['xpan',          # move along x
                               'xwheel_pan',    # move along x with wheel
                               'xwheel_zoom',   # zoom on x with wheel
                               'xzoom_in',      # zoom in on x
                               'xzoom_out',     # zoom out on x
                               'crosshair',     # show where the mouse is on axis
                               'xbox_zoom',     # zoom on selection along x
                               'undo',          # undo action
                               'redo'],         # redo action
                        width=1200, height=550,
                        aggregator='any',
                        datashade=True)

我有这个数字:

EN

回答 1

Stack Overflow用户

发布于 2021-01-04 00:11:24

您可以使用.opts(default_tools=[])来摆脱默认工具:

示例代码:

代码语言:javascript
复制
import numpy as np
import pandas as pd

import hvplot.pandas

df = pd.DataFrame({
    'x': np.random.normal(size=50),
    'y': np.random.normal(size=50),
})

scatter_plot = df.hvplot.scatter(
    x='x', y='y', 
    tools=['tap','box_select'])

# manually specifying the default tools gets rid of any preset default tools
# you also just use an empty list here
scatter_plot.opts(default_tools=['wheel_zoom'])

另请参阅此问题+答案:

How to control (active) tools in holoviews with bokeh backend

仅使用指定工具和默认工具生成的图:

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63260798

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档