Skip to content

zoom_factory does not preserve canvas position #7

Open
@antoniovazquezblanco

Description

@antoniovazquezblanco

Bug report

When using zoom_factory, scrolling events do not preserve current canvas position...

zoom_factory

Code for reproduction

#!/usr/bin/env python

from matplotlib import pyplot
from mpl_interactions import zoom_factory
import numpy as np

fig = pyplot.gcf()
zoom_factory(fig.gca())

t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)
fig.gca().plot(t, s)

pyplot.show()

Actual outcome

Whenever I pan my figure, if an scroll event takes place, I am automatically panned to the previous location...

Expected outcome

Whenever I pan my figure, if an scroll event takes place, only zoom should be affected and no panning should take place...

Version Info

  • Operating system: Affects both Windows and Archlinux
  • Matplotlib version: 3.7.1
  • Python version: 3.11.2 & 3.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions