1

I'm using HvPlot and it works perfectly but I don't know how to delete the default tools 'pan', 'wheel_zoom' and 'box_zoom'. My code for the HvPlot is :

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)

I have this figure :

enter image description here

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96
Hugo Lima
  • 21
  • 2

1 Answers1

0

You can use .opts(default_tools=[]) to get rid of the default tools:

Example code:

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'])

See also this question + answers:
How to control (active) tools in holoviews with bokeh backend

Resulting plot with only the specified tools and default tools:

holoviews plot with only specified tools and default tools

Sander van den Oord
  • 10,986
  • 5
  • 51
  • 96