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 d42b2b0

Browse filesBrowse files
committed
Add PathCollection test for ps backend
1 parent 12d3c8e commit d42b2b0
Copy full SHA for d42b2b0

File tree

Expand file treeCollapse file tree

3 files changed

+329
-1
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+329
-1
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
526526
The font properties.
527527
angle : float
528528
The rotation angle in degrees anti-clockwise.
529+
ismath : bool or "TeX"
530+
If True, use mathtext parser. If "TeX", use *usetex* mode.
529531
mtext : `matplotlib.text.Text`
530532
The original text object to be rendered.
531533

‎lib/matplotlib/tests/baseline_images/test_backend_ps/scatter.eps

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/baseline_images/test_backend_ps/scatter.eps
+306Lines changed: 306 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/matplotlib/tests/test_backend_ps.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_backend_ps.py
+21-1Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
import re
55
import tempfile
66

7+
import numpy as np
78
import pytest
89

9-
from matplotlib import cbook, patheffects
10+
from matplotlib import cbook, path, patheffects
1011
from matplotlib._api import MatplotlibDeprecationWarning
1112
from matplotlib.figure import Figure
1213
from matplotlib.patches import Ellipse
1314
from matplotlib.testing.decorators import check_figures_equal, image_comparison
1415
from matplotlib.testing._markers import needs_ghostscript, needs_usetex
1516
import matplotlib as mpl
17+
import matplotlib.collections as mcollections
1618
import matplotlib.pyplot as plt
1719

1820

@@ -272,3 +274,21 @@ def test_no_duplicate_definition():
272274
if ln.startswith('/')]
273275

274276
assert max(Counter(wds).values()) == 1
277+
278+
279+
@image_comparison(["scatter.eps"])
280+
def test_path_collection():
281+
rng = np.random.default_rng(19680801)
282+
xvals = rng.uniform(0, 1, 10)
283+
yvals = rng.uniform(0, 1, 10)
284+
sizes = rng.uniform(30, 100, 10)
285+
fig, ax = plt.subplots()
286+
ax.scatter(xvals, yvals, sizes, edgecolor=[0.9, 0.2, 0.1], marker='<')
287+
ax.set_axis_off()
288+
paths = [path.Path.unit_regular_polygon(i) for i in range(3, 7)]
289+
offsets = rng.uniform(0, 200, 20).reshape(10, 2)
290+
sizes = [0.02, 0.04]
291+
pc = mcollections.PathCollection(paths, sizes, zorder=-1,
292+
facecolors='yellow', offsets=offsets)
293+
ax.add_collection(pc)
294+
ax.set_xlim(0, 1)

0 commit comments

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