# How to set scrollZoom using FigureWidget()?

**URL:** <https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618>\
**Category:** 📊 Plotly Python\
**Created:** [February 14, 2019, 11:40pm UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618 "2019-02-14T23:40:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ctypsy](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@ctypsy](https://community.plotly.com/u/ctypsy)\
**Post date:** [February 14, 2019, 11:40pm UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618/1 "2019-02-14T23:40:43Z")

</div>

how to set scrollZoom when using FigureWidget(). If works through plot(config={scrollZoom=True}).  
Also, how would it be possible to zoom only x axis through mouse scrolling?

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [February 15, 2019, 10:39am UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618/2 "2019-02-15T10:39:22Z")

</div>

Hi @ctypsy,

Unfortunately, FigureWidget doesn’t support config options yet. See [pass config options to FigureWidget · Issue #1074 · plotly/plotly.py · GitHub](https://github.com/plotly/plotly.py/issues/1074).

> Also, how would it be possible to zoom only x axis through mouse scrolling?

For 2D cartesian axes, you can do this by scrolling with the mouse on the x or y axis

-Jon

---

<div class="post-metadata">

**Author:** ![ctypsy](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@ctypsy](https://community.plotly.com/u/ctypsy)\
**Post date:** [February 15, 2019, 11:31am UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618/3 "2019-02-15T11:31:32Z")

</div>

I thought so. I’ve read through the issue you mentioned above.

Sorry for being annoying, but would it be possible to achieve scroll horizontal zoom with similar method than this one (through .layout.on\_change\_:

> [@Y-axis autoscaling with x-range sliders](https://community.plotly.com/t/y-axis-autoscaling-with-x-range-sliders/10245):
>
> Afaik, y-axis cant be made to auto scale when using x-range sliders. Y range is chosen with respect to the y values of the whole x range and does not change after zooming-in. This is especially annoying with candlestick charts in volatile periods. When you zoom-in using x-range slider, you essentially get flat candlesticks as their fluctuations only cover a very small part of the initial range. After doing some research it seems that some progress has been made here: [https://github.com/plotly/pl…](https://github.com/plotly/plotly.js/pull/2364)

…and somehow recognize mouse scroll as appropriate event?

Thank you very much in advance @jmmease

---

<div class="post-metadata">

**Author:** ![jmmease](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jmmease/32/3706_2.png) [@jmmease](https://community.plotly.com/u/jmmease)\
**Post date:** [February 15, 2019, 12:53pm UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618/4 "2019-02-15T12:53:54Z")

</div>

Hi @ctypsy,

Not annoying at all, I definitely understand the drive to get something working! I’ll try to take a look at this for plotly.py 3.7.0, but I can’t guarantee it will make it in.

Now this isn’t something I’ve tried, but you might want to look at [ipyevents](https://github.com/mwcraig/ipyevents.). This looks to be designed to allow you to catch extra events around an ipywidget, and it even mentions wheel events.

If you do give it a try, please let us know how it goes!  
-Jon

---

<div class="post-metadata">

**Author:** ![ctypsy](https://avatars.discourse-cdn.com/v4/letter/c/e36b37/32.png) [@ctypsy](https://community.plotly.com/u/ctypsy)\
**Post date:** [February 15, 2019, 1:05pm UTC](https://community.plotly.com/t/how-to-set-scrollzoom-using-figurewidget/19618/5 "2019-02-15T13:05:45Z")

</div>

OMG, yeah, awesome idea! Jumping in…
