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 b7381e9

Browse filesBrowse files
authored
Merge pull request #23254 from oscargus/testpsscatter
Add PathCollection test for ps backend
2 parents 97b42f8 + f4069ee commit b7381e9
Copy full SHA for b7381e9

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
@@ -525,6 +525,8 @@ def draw_text(self, gc, x, y, s, prop, angle, ismath=False, mtext=None):
525525
The font properties.
526526
angle : float
527527
The rotation angle in degrees anti-clockwise.
528+
ismath : bool or "TeX"
529+
If True, use mathtext parser. If "TeX", use *usetex* mode.
528530
mtext : `matplotlib.text.Text`
529531
The original text object to be rendered.
530532

‎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, font_manager as fm
10+
from matplotlib import cbook, path, patheffects, font_manager as fm
1011
from matplotlib._api import MatplotlibDeprecationWarning
1112
from matplotlib.figure import Figure
1213
from matplotlib.patches import Ellipse
1314
from matplotlib.testing._markers import needs_ghostscript, needs_usetex
1415
from matplotlib.testing.decorators import check_figures_equal, image_comparison
1516
import matplotlib as mpl
17+
import matplotlib.collections as mcollections
1618
import matplotlib.pyplot as plt
1719

1820

@@ -298,3 +300,21 @@ def test_multi_font_type42():
298300

299301
fig = plt.figure()
300302
fig.text(0.15, 0.475, "There are 几个汉字 in between!")
303+
304+
305+
@image_comparison(["scatter.eps"])
306+
def test_path_collection():
307+
rng = np.random.default_rng(19680801)
308+
xvals = rng.uniform(0, 1, 10)
309+
yvals = rng.uniform(0, 1, 10)
310+
sizes = rng.uniform(30, 100, 10)
311+
fig, ax = plt.subplots()
312+
ax.scatter(xvals, yvals, sizes, edgecolor=[0.9, 0.2, 0.1], marker='<')
313+
ax.set_axis_off()
314+
paths = [path.Path.unit_regular_polygon(i) for i in range(3, 7)]
315+
offsets = rng.uniform(0, 200, 20).reshape(10, 2)
316+
sizes = [0.02, 0.04]
317+
pc = mcollections.PathCollection(paths, sizes, zorder=-1,
318+
facecolors='yellow', offsets=offsets)
319+
ax.add_collection(pc)
320+
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.