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 16f6655

Browse filesBrowse files
authored
Merge pull request #6611 from efiring/scatter_custom
BUG: scatter, check for verts before setting default marker
2 parents 74ead7c + 09e49c3 commit 16f6655
Copy full SHA for 16f6655

File tree

Expand file treeCollapse file tree

3 files changed

+15
-5
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+15
-5
lines changed

‎lib/matplotlib/axes/_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axes/_axes.py
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,15 +3958,15 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None,
39583958

39593959
scales = s # Renamed for readability below.
39603960

3961-
# load default marker from rcParams
3962-
if marker is None:
3963-
marker = rcParams['scatter.marker']
3964-
39653961
# to be API compatible
39663962
if marker is None and not (verts is None):
39673963
marker = (verts, 0)
39683964
verts = None
39693965

3966+
# load default marker from rcParams
3967+
if marker is None:
3968+
marker = rcParams['scatter.marker']
3969+
39703970
if isinstance(marker, mmarkers.MarkerStyle):
39713971
marker_obj = marker
39723972
else:
Loading

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ def test_scatter_plot():
12831283
@image_comparison(baseline_images=['scatter_marker'], remove_text=True,
12841284
extensions=['png'])
12851285
def test_scatter_marker():
1286-
fig, (ax0, ax1) = plt.subplots(ncols=2)
1286+
fig, (ax0, ax1, ax2) = plt.subplots(ncols=3)
12871287
ax0.scatter([3, 4, 2, 6], [2, 5, 2, 3],
12881288
c=[(1, 0, 0), 'y', 'b', 'lime'],
12891289
s=[60, 50, 40, 30],
@@ -1294,6 +1294,16 @@ def test_scatter_marker():
12941294
s=[60, 50, 40, 30],
12951295
edgecolors=['k', 'r', 'g', 'b'],
12961296
marker=mmarkers.MarkerStyle('o', fillstyle='top'))
1297+
# unit area ellipse
1298+
rx, ry = 3, 1
1299+
area = rx * ry * np.pi
1300+
theta = np.linspace(0, 2 * np.pi, 21)
1301+
verts = list(zip(np.cos(theta) * rx / area, np.sin(theta) * ry / area))
1302+
ax2.scatter([3, 4, 2, 6], [2, 5, 2, 3],
1303+
c=[(1, 0, 0), 'y', 'b', 'lime'],
1304+
s=[60, 50, 40, 30],
1305+
edgecolors=['k', 'r', 'g', 'b'],
1306+
verts=verts)
12971307

12981308

12991309
@image_comparison(baseline_images=['scatter_2D'], remove_text=True,

0 commit comments

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