Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b6eb043

Browse filesBrowse files
authored
Merge pull request #8720 from efiring/simplify_cla_share
MNT: Simplify cla sharex/sharey code;
2 parents b07fbb8 + 4193a4f commit b6eb043
Copy full SHA for b6eb043

File tree

Expand file treeCollapse file tree

1 file changed

+4
-30
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-30
lines changed

‎lib/matplotlib/axes/_base.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_base.py
+4-30Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -980,21 +980,8 @@ def cla(self):
980980
self.xaxis.minor = self._sharex.xaxis.minor
981981
x0, x1 = self._sharex.get_xlim()
982982
self.set_xlim(x0, x1, emit=False, auto=None)
983-
984-
# Save the current formatter/locator so we don't lose it
985-
majf = self._sharex.xaxis.get_major_formatter()
986-
minf = self._sharex.xaxis.get_minor_formatter()
987-
majl = self._sharex.xaxis.get_major_locator()
988-
minl = self._sharex.xaxis.get_minor_locator()
989-
990-
# This overwrites the current formatter/locator
991-
self.xaxis._set_scale(self._sharex.xaxis.get_scale())
992-
993-
# Reset the formatter/locator
994-
self.xaxis.set_major_formatter(majf)
995-
self.xaxis.set_minor_formatter(minf)
996-
self.xaxis.set_major_locator(majl)
997-
self.xaxis.set_minor_locator(minl)
983+
self.xaxis._scale = mscale.scale_factory(
984+
self._sharex.xaxis.get_scale(), self.xaxis)
998985
else:
999986
self.xaxis._set_scale('linear')
1000987
try:
@@ -1007,21 +994,8 @@ def cla(self):
1007994
self.yaxis.minor = self._sharey.yaxis.minor
1008995
y0, y1 = self._sharey.get_ylim()
1009996
self.set_ylim(y0, y1, emit=False, auto=None)
1010-
1011-
# Save the current formatter/locator so we don't lose it
1012-
majf = self._sharey.yaxis.get_major_formatter()
1013-
minf = self._sharey.yaxis.get_minor_formatter()
1014-
majl = self._sharey.yaxis.get_major_locator()
1015-
minl = self._sharey.yaxis.get_minor_locator()
1016-
1017-
# This overwrites the current formatter/locator
1018-
self.yaxis._set_scale(self._sharey.yaxis.get_scale())
1019-
1020-
# Reset the formatter/locator
1021-
self.yaxis.set_major_formatter(majf)
1022-
self.yaxis.set_minor_formatter(minf)
1023-
self.yaxis.set_major_locator(majl)
1024-
self.yaxis.set_minor_locator(minl)
997+
self.yaxis._scale = mscale.scale_factory(
998+
self._sharey.yaxis.get_scale(), self.yaxis)
1025999
else:
10261000
self.yaxis._set_scale('linear')
10271001
try:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.