8000 reverting some unnecessary changes · matplotlib/matplotlib@f9b9da1 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9b9da1

Browse files
committed
reverting some unnecessary changes
1 parent 7d58055 commit f9b9da1

File tree

3 files changed

+18
-43
lines changed

3 files changed

+18
-43
lines changed

lib/matplotlib/lines.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -790,25 +790,6 @@ def draw(self, renderer):
790790
cap = self._dashcapstyle
791791
join = self._dashjoinstyle
792792
else:
793-
if tpath.should_simplify and affine.has_inverse:
794-
# The path simplification code expects the path
795-
# to be in pixel space, not data space, but the
796-
# renderer downstream expects the path to be
797-
# in data space. The transformation `affine`
798-
# will put the path into pixel space, and
799-
# affine.inverted() will transform it back to
800-
# data space. So, transform using affine, simplify
801-
# the path, and transform using the affine inverted.
802-
#
803-
# This may be inefficient, but it appears to be the
804-
# only way forward at the moment. It's possible that
805-
# the problem only lies in path clipping inside
806-
# src/path_converters.h, but that is only a
807-
# hypothesis. Despite the inefficiency, it is still
808-
# faster than *not* simplifying.
809-
tpath = affine.inverted().transform_path(
810-
affine.transform_path(tpath).cleaned(simplify=True)
811-
)
812793
cap = self._solidcapstyle
813794
join = self._solidjoinstyle
814795

lib/matplotlib/mpl-data/stylelib/_classic_test.mplstyle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ agg.path.chunksize : 0 # 0 to disable; values in the range
393393
# A value of 20000 is probably a good
394394
# starting point.
395395
### SAVING FIGURES
396-
path.simplify : False # When True, simplify paths by removing "invisible"
396+
path.simplify : True # When True, simplify paths by removing "invisible"
397397
# points to reduce file size and increase rendering
398398
# speed
399399
path.simplify_threshold : 0.1111111111111111

lib/matplotlib/tests/test_simplification.py

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@
1515
from matplotlib.path import Path
1616

1717

18-
@pytest.fixture
19-
def set_simplify_and_threshold():
20-
plt.rcParams['path.simplify'] = True
21-
plt.rcParams['path.simplify_threshold'] = 0.1111111111111111
22-
23-
2418
@image_comparison(baseline_images=['clipping'], remove_text=True)
25-
def test_clipping(set_simplify_and_threshold):
19+
def test_clipping():
2620
t = np.arange(0.0, 2.0, 0.01)
2721
s = np.sin(2*np.pi*t)
2822

@@ -32,7 +26,7 @@ def test_clipping(set_simplify_and_threshold):
3226

3327

3428
@image_comparison(baseline_images=['overflow'], remove_text=True)
35-
def test_overflow(set_simplify_and_threshold):
29+
def test_overflow():
3630
x = np.array([1.0, 2.0, 3.0, 2.0e5])
3731
y = np.arange(len(x))
3832

@@ -42,7 +36,7 @@ def test_overflow(set_simplify_and_threshold):
4236

4337

4438
@image_comparison(baseline_images=['clipping_diamond'], remove_text=True)
45-
def test_diamond(set_simplify_and_threshold):
39+
def test_diamond():
4640
x = np.array([0.0, 1.0, 0.0, -1.0, 0.0])
4741
y = np.array([1.0, 0.0, -1.0, 0.0, 1.0])
4842

@@ -52,7 +46,7 @@ def test_diamond(set_simplify_and_threshold):
5246
ax.set_ylim(ymin=-0.6, ymax=0.6)
5347

5448

55-
def test_noise(set_simplify_and_threshold):
49+
def test_noise():
5650
np.random.seed(0)
5751
x = np.random.uniform(size=(50000,)) * 50
5852

@@ -64,10 +58,10 @@ def test_noise(set_simplify_and_threshold):
6458
path = transform.transform_path(path)
6559
simplified = path.cleaned(simplify=True)
6660

67-
assert simplified.vertices.size == 25888
61+
assert simplified.vertices.size == 25510
6862

6963

70-
def test_antiparallel_simplification(set_simplify_and_threshold):
64+
def test_antiparallel_simplification():
7165
def _get_simplified(x,y):
7266
fig, ax = plt.subplots()
7367
p1 = ax.plot(x, y)
@@ -141,7 +135,7 @@ def _get_simplified(x,y):
141135
[ 1. , 0.5]],
142136
simplified.vertices[:-2, :])
143137

144-
def test_sine_plus_noise(set_simplify_and_threshold):
138+
def test_sine_plus_noise():
145139
np.random.seed(0)
146140
x = (np.sin(np.linspace(0, np.pi * 2.0, 50000)) +
147141
np.random.uniform(size=(50000,)) * 0.01)
@@ -154,11 +148,11 @@ def test_sine_plus_noise(set_simplify_and_threshold):
154148
path = transform.transform_path(path)
155149
simplified = path.cleaned(simplify=True)
156150

157-
assert simplified.vertices.size == 25598
151+
assert simplified.vertices.size == 25238
158152

159153

160154
@image_comparison(baseline_images=['simplify_curve'], remove_text=True)
161-
def test_simplify_curve(set_simplify_and_threshold):
155+
def test_simplify_curve():
162156
pp1 = patches.PathPatch(
163157
Path([(0, 0), (1, 0), (1, 1), (np.nan, 1), (0, 0), (2, 0), (2, 2),
164158
(0, 0)],
@@ -173,15 +167,15 @@ def test_simplify_curve(set_simplify_and_threshold):
173167

174168

175169
@image_comparison(baseline_images=['hatch_simplify'], remove_text=True)
176-
def test_hatch(set_simplify_and_threshold):
170+
def test_hatch():
177171
fig, ax = plt.subplots()
178172
ax.add_patch(plt.Rectangle((0, 0), 1, 1, fill=False, hatch="/"))
179173
ax.set_xlim((0.45, 0.55))
180174
ax.set_ylim((0.45, 0.55))
181175

182176

183177
@image_comparison(baseline_images=['fft_peaks'], remove_text=True)
184-
def test_fft_peaks(set_simplify_and_threshold):
178+
def test_fft_peaks():
185179
fig, ax = plt.subplots()
186180
t = np.arange(65536)
187181
p1 = ax.plot(abs(np.fft.fft(np.sin(2*np.pi*.01*t)*np.blackman(len(t)))))
@@ -191,10 +185,10 @@ def test_fft_peaks(set_simplify_and_threshold):
191185
path = transform.transform_path(path)
192186
simplified = path.cleaned(simplify=True)
193187

194-
assert simplified.vertices.size == 38
188+
assert simplified.vertices.size == 36
195189

196190

197-
def test_start_with_moveto(set_simplify_and_threshold):
191+
def test_start_with_moveto():
198192
# Should be entirely clipped away to a single MOVETO
199193
data = b"""
200194
ZwAAAAku+v9UAQAA+Tj6/z8CAADpQ/r/KAMAANlO+v8QBAAAyVn6//UEAAC6ZPr/2gUAAKpv+v+8
@@ -249,7 +243,7 @@ def test_throw_rendering_complexity_exceeded():
249243

250244

251245
@image_comparison(baseline_images=['clipper_edge'], remove_text=True)
252-
def test_clipper(set_simplify_and_threshold):
246+
def test_clipper():
253247
dat = (0, 1, 0, 2, 0, 3, 0, 4, 0, 5)
254248
fig = plt.figure(figsize=(2, 1))
255249
fig.subplots_adjust(left=0, bottom=0, wspace=0, hspace=0)
@@ -265,7 +259,7 @@ def test_clipper(set_simplify_and_threshold):
265259

266260

267261
@image_comparison(baseline_images=['para_equal_perp'], remove_text=True)
268-
def test_para_equal_perp(set_simplify_and_threshold):
262+
def test_para_equal_perp():
269263
x = np.array([0, 1, 2, 1, 0, -1, 0, 1] + [1] * 128)
270264
y = np.array([1, 1, 2, 1, 0, -1, 0, 0] + [0] * 128)
271265

@@ -275,7 +269,7 @@ def test_para_equal_perp(set_simplify_and_threshold):
275269

276270

277271
@image_comparison(baseline_images=['clipping_with_nans'])
278-
def test_clipping_with_nans(set_simplify_and_threshold):
272+
def test_clipping_with_nans():
279273
x = np.linspace(0, 3.14 * 2, 3000)
280274
y = np.sin(x)
281275
x[::100] = np.nan
@@ -285,7 +279,7 @@ def test_clipping_with_nans(set_simplify_and_threshold):
285279
ax.set_ylim(-0.25, 0.25)
286280

287281

288-
def test_clipping_full(set_simplify_and_threshold):
282+
def test_clipping_full():
289283
p = Path([[1e30, 1e30]] * 5)
290284
simplified = list(p.iter_segments(clip=[0, 0, 100, 100]))
291285
assert simplified == []

0 commit comments

Comments
 (0)
0