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 14dda09

Browse filesBrowse files
authored
Merge pull request #28911 from timhoffm/mnt-lazyticklist
MNT: Fix double evaluation of _LazyTickList
2 parents cef6af6 + f1b0a28 commit 14dda09
Copy full SHA for 14dda09

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+10
-4
lines changed
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Axes creation speedup
2+
~~~~~~~~~~~~~~~~~~~~~
3+
4+
Creating an Axes is now 20-25% faster due to internal optimizations.

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,17 +538,19 @@ def __get__(self, instance, owner):
538538
# instance._get_tick() can itself try to access the majorTicks
539539
# attribute (e.g. in certain projection classes which override
540540
# e.g. get_xaxis_text1_transform). In order to avoid infinite
541-
# recursion, first set the majorTicks on the instance to an empty
542-
# list, then create the tick and append it.
541+
# recursion, first set the majorTicks on the instance temporarily
542+
# to an empty lis. Then create the tick; note that _get_tick()
543+
# may call reset_ticks(). Therefore, the final tick list is
544+
# created and assigned afterwards.
543545
if self._major:
544546
instance.majorTicks = []
545547
tick = instance._get_tick(major=True)
546-
instance.majorTicks.append(tick)
548+
instance.majorTicks = [tick]
547549
return instance.majorTicks
548550
else:
549551
instance.minorTicks = []
550552
tick = instance._get_tick(major=False)
551-
instance.minorTicks.append(tick)
553+
instance.minorTicks = [tick]
552554
return instance.minorTicks
553555

554556

0 commit comments

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