File tree 2 files changed +16
-2
lines changed
Filter options
2 files changed +16
-2
lines changed
Original file line number Diff line number Diff line change 5
5
import numpy as np
6
6
from numpy .testing import assert_almost_equal
7
7
import pytest
8
-
8
+ import time
9
9
import matplotlib as mpl
10
10
from matplotlib .backend_bases import MouseEvent
11
11
from matplotlib .font_manager import FontProperties
@@ -756,3 +756,17 @@ def test_pdf_chars_beyond_bmp():
756
756
plt .rcParams ['mathtext.fontset' ] = 'stixsans'
757
757
plt .figure ()
758
758
plt .figtext (0.1 , 0.5 , "Mass $m$ \U00010308 " , size = 30 )
759
+
760
+
761
+ def test_cache_large_labels ():
762
+ """Test to verify cache helps when ticks are too large"""
763
+ times = []
764
+ for pow in range (1 , 5 ):
765
+ labels = [i for i in range (10 ** pow )]
766
+ t0 = time .perf_counter ()
767
+ plt .figure ()
768
+ plt .xticks (labels )
769
+ plt .yticks (labels )
770
+ times .append (time .perf_counter ()- t0 )
771
+ assert times [- 1 ] > times [0 ]
772
+ assert times [- 1 ] > times [- 2 ]
Original file line number Diff line number Diff line change @@ -107,7 +107,6 @@ class Text(Artist):
107
107
"""Handle storing and drawing of text in window or data coordinates."""
108
108
109
109
zorder = 3
110
- _cached = cbook .maxdict (50 )
111
110
112
111
def __repr__ (self ):
113
112
return "Text(%s, %s, %s)" % (self ._x , self ._y , repr (self ._text ))
@@ -158,6 +157,7 @@ def __init__(self,
158
157
self ._linespacing = linespacing
159
158
self .set_rotation_mode (rotation_mode )
160
159
self .update (kwargs )
160
+ self ._cached = cbook .maxdict (50 )
161
161
162
162
def update (self , kwargs ):
163
163
# docstring inherited
You can’t perform that action at this time.
0 commit comments