8000 tidy up · matplotlib/matplotlib@009cff0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 009cff0

Browse files
committed
tidy up
1 parent 6746bb4 commit 009cff0

File tree

3 files changed

+29
-38
lines changed

3 files changed

+29
-38
lines changed

examples/pylab_examples/markevery_demo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
cols = 3
3636
gs = gridspec.GridSpec(len(cases) // cols + 1, cols)
3737

38-
#define the data for catesian plots
38+
#define the data for cartesian plots
3939
delta = 0.11
4040
x = np.linspace(0, 10 - 2 * delta, 200) + delta
4141
y = np.sin(x) + 1.0 + delta

lib/matplotlib/lines.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,41 +343,40 @@ def set_fillstyle(self, fs):
343343
def set_markevery(self, every):
344344
"""Set the markevery property to subsample the plot when using markers.
345345
346-
e.g., if `markevery=5`, every 5-th marker will be plotted.
347-
346+
e.g., if `every=5`, every 5-th marker will be plotted.
348347
349348
Parameters
350349
----------
351350
every: None | int | length-2 tuple of int | slice | list/array of int |
352351
float | length-2 tuple of float
353352
Which markers to plot.
354353
355-
- If every=None, every point will be plotted.
356-
- If every=N, every N-th marker will be plotted starting with
354+
- every=None, every point will be plotted.
355+
- every=N, every N-th marker will be plotted starting with
357356
marker 0.
358-
- If every=(start, N), every N-th marker, starting at point
357+
- every=(start, N), every N-th marker, starting at point
359358
start, will be plotted.
360-
- If every=slice(start, end, N), every N-th marker, starting at
359+
- every=slice(start, end, N), every N-th marker, starting at
361360
point start, upto but not including point end, will be plotted.
362-
- If every=[i, j, m, n], only markers at points i, j, m, and n
361+
- every=[i, j, m, n], only markers at points i, j, m, and n
363362
will be plotted.
364363
- every=0.1, (i.e. a float) then markers will be spaced at
365364
approximately equal distances along the line; the distance
366365
along the line between markers is determined by multiplying the
367366
display-coordinate distance of the axes bounding-box diagonal
368367
by the value of every.
369-
- For every=(0.5, 0.1) (i.e. a length-2 tuple of float), the
368+
- every=(0.5, 0.1 8000 ) (i.e. a length-2 tuple of float), the
370369
same functionality as every=0.1 is exhibited but the first
371370
marker will be 0.5 multiplied by the
372371
display-cordinate-diagonal-distance along the line.
373372
374-
375373
Notes
376374
-----
377-
Using `markevery` will only show markers at actual data points. When
378-
using float arguments to `markevery` on irregularly spaced data, the
379-
markers will likely not appear evenly spaced because the actual data
380-
points do not coincide with the theoretical spacing between markers.
375+
Setting the markevery property will only show markers at actual data
376+
points. When using float arguments to set the markevery property
377+
on irregularly spaced data, the markers will likely not appear evenly
378+
spaced because the actual data points do not coincide with the
379+
theoretical spacing between markers.
381380
382381
When using a start offset to specify the first marker, the offset will
383382
be from the first data point which may be different from the first

lib/matplotlib/tests/test_axes.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -863,14 +863,12 @@ def test_markevery_linear_scales():
863863
x = np.linspace(0, 10 - 2 * delta, 200) + delta
864864
y = np.sin(x) + 1.0 + delta
865865

866-
fig = plt.figure()
867-
ax = []
868866
for i, case in enumerate(cases):
869867
row = (i // cols)
870868
col = i % cols
871-
ax.append(fig.add_subplot(gs[row, col]))
872-
ax[-1].set_title('markevery=%s' % str(case))
873-
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
869+
plt.subplot(gs[row, col])
870+
plt.title('markevery=%s' % str(case))
871+
plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
874872

875873
@image_comparison(baseline_images=['markevery_linear_scales_zoomed'],
876874
remove_text=True)
@@ -890,16 +888,14 @@ def test_markevery_linear_scales_zoomed():
890888
x = np.linspace(0, 10 - 2 * delta, 200) + delta
891889
y = np.sin(x) + 1.0 + delta
892890

893-
fig = plt.figure()
894-
ax = []
895891
for i, case in enumerate(cases):
896892
row = (i // cols)
897893
col = i % cols
898-
ax.append(fig.add_subplot(gs[row, col]))
899-
ax[-1].set_title('markevery=%s' % str(case))
900-
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
901-
ax[-1].set_xlim((6, 6.7))
902-
ax[-1].set_ylim((1.1, 1.7))
894+
plt.subplot(gs[row, col])
895+
plt.title('markevery=%s' % str(case))
896+
plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
897+
plt.xlim((6, 6.7))
898+
plt.ylim((1.1, 1.7))
903899

904900

905901
@image_comparison(baseline_images=['markevery_log_scales'],
@@ -920,16 +916,14 @@ def test_markevery_log_scales():
920916
x = np.linspace(0, 10 - 2 * delta, 200) + delta
921917
y = np.sin(x) + 1.0 + delta
922918

923-
fig = plt.figure()
924-
ax = []
925919
for i, case in enumerate(cases):
926920
row = (i // cols)
927921
col = i % cols
928-
ax.append(fig.add_subplot(gs[row, col]))
929-
ax[-1].set_title('markevery=%s' % str(case))
930-
ax[-1].set_xscale('log')
931-
ax[-1].set_yscale('log')
932-
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
922+
plt.subplot(gs[row, col])
923+
plt.title('markevery=%s' % str(case))
924+
plt.xscale('log')
925+
plt.yscale('log')
926+
plt.plot(x, y, 'o', ls='-', ms=4, markevery=case)
933927

934928
@image_comparison(baseline_images=['markevery_polar'],
935929
remove_text=True)
@@ -948,14 +942,12 @@ def test_markevery_polar():
948942
r = np.linspace(0, 3.0, 200)
949943
theta = 2 * np.pi * r
950944

951-
fig = plt.figure()
952-
ax = []
953945
for i, case in enumerate(cases):
954946
row = (i // cols)
955947
col = i % cols
956-
ax.append(fig.add_subplot(gs[row, col], polar = True))
957-
ax[-1].set_title('markevery=%s' % str(case))
958-
ax[-1].plot(theta, r, 'o', ls='-', ms=4, markevery=case)
948+
plt.subplot(gs[row, col], polar = True)
949+
plt.title('markevery=%s' % str(case))
950+
plt.plot(theta, r, 'o', ls='-', ms=4, markevery=case)
959951

960952

961953
@image_comparison(baseline_images=['marker_edges'],

0 commit comments

Comments
 (0)
0