Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8032f52

Browse files
committed
Use one transform call for both x and y
1 parent 3f9098d commit 8032f52

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,8 +2593,8 @@ def scroll_handler(event, canvas=None, toolbar=None):
25932593

25942594
xmin, xmax = ax.get_xlim()
25952595
ymin, ymax = ax.get_ylim()
2596-
xmin, ymin = ax.transScale.transform((xmin, ymin))
2597-
xmax, ymax = ax.transScale.transform((xmax, ymax))
2596+
(xmin, ymin), (xmax, ymax) = ax.transScale.transform(
2597+
[(xmin, ymin), (xmax, ymax)])
25982598

25992599
# mouse position in scaled (e.g., log) data coordinates
26002600
x, y = ax.transScale.transform((event.xdata, event.ydata))
@@ -2606,8 +2606,8 @@ def scroll_handler(event, canvas=None, toolbar=None):
26062606
new_ymax = y + (ymax - y) * scale_factor
26072607

26082608
inv_scale = ax.transScale.inverted()
2609-
new_xmin, new_ymin = inv_scale.transform((new_xmin, new_ymin))
2610-
new_xmax, new_ymax = inv_scale.transform((new_xmax, new_ymax))
2609+
(new_xmin, new_ymin), (new_xmax, new_ymax) = inv_scale.transform(
2610+
[(new_xmin, new_ymin), (new_xmax, new_ymax)])
26112611

26122612
ax.set_xlim(new_xmin, new_xmax)
26132613
ax.set_ylim(new_ymin, new_ymax)

0 commit comments

Comments
 (0)