Black Lives Matter. Please consider donating to Black Girls Code today.

Custom plot controls similar to the hover bar

I was wondering if it is possible to mimic the controls in the hover (i.e pan/zoom/lasso) with buttons that I create. I have read about setting layout.dragmode to zoom or pan. Ideally, I would like to attach layout.dragmode to the button. Unfortunately, this doesn’t seem to be working for me. Any tips or links are greatly appreciated.

Here’s a few example a custom mode bar buttons:

to help get started.

1 Like

Thank you for the links. What I mean by custom controls is creating button elements, for instance, and hooking up functions to said buttons to mimic the capabilities of the hover bar. I’ve forked one of your examples and added the functions and elements:

Here, I’ve created two buttons for Panning and Saving the plot. Currently, the function only logs some text. I would like to replace this with the syntax to enter the panning mode or to save the image. For the Save button, I’ve included some code to save the image. This is referenced in the documentation.