Skip to content

Conversation

@Azaya89
Copy link
Contributor

@Azaya89 Azaya89 commented Oct 28, 2025

fixes #6240

This PR fixes the problem where tools specified via .opts(tools=[...]) on an Overlay were being ignored. The OverlayPlot._init_tools() method only collected tools from subplots but never processed tools from self.default_tools and self.tools.

Solution

  • Added logic to iterate through self.default_tools + self.tools and add them to the plot
  • Improved tool deduplication: Replaced simple type-based deduplication (tool_types list) with unique identifier-based deduplication (tool_ids set). This is better since most bokeh tools like PanTool have variants differentiated only by their dimensions (e.g., 'pan', 'xpan', 'ypan' are all of type PanTool)
  • Preserved special handling for hover tools and subcoordinate_y zoom tools which was causing the initial test failures
  • Added tests
import holoviews as hv
hv.extension('bokeh')

overlay = (hv.Curve([1, 2, 3]).opts(tools=['xpan']) * hv.Curve([2, 3, 4]).opts(tools=['ypan', 'zoom_out'])).opts(tools=['zoom_in', 'xpan', 'ypan'])
overlay
Screenshot 2025-11-27 at 7 33 49 PM

@Azaya89 Azaya89 self-assigned this Oct 28, 2025
@Azaya89
Copy link
Contributor Author

Azaya89 commented Oct 28, 2025

This works now but it seems a bit verbose to me. Will try to find a more elegant way to implement...

@codecov
Copy link

codecov bot commented Oct 29, 2025

Codecov Report

❌ Patch coverage is 99.31034% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.22%. Comparing base (c4ee605) to head (7cdb736).

Files with missing lines Patch % Lines
holoviews/plotting/bokeh/element.py 97.95% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6713      +/-   ##
==========================================
+ Coverage   89.20%   89.22%   +0.01%     
==========================================
  Files         332      332              
  Lines       72010    72135     +125     
==========================================
+ Hits        64240    64364     +124     
- Misses       7770     7771       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Azaya89 Azaya89 marked this pull request as ready for review October 29, 2025 15:11
@Azaya89 Azaya89 requested review from hoxbro and maximlt October 29, 2025 15:11
@hoxbro hoxbro added this to the 1.22.1 milestone Oct 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adding tools to an Overlay has no effect

3 participants