matplotlib/matplotlib — pull request #2662 by rtrwalker (2013-12-09 03:34:23+00:00)
Title: allow slice and fancy indexing to only show some markers 

The `markevery` keword argument can be passed to plt.plot in order to plot a marker every N points. I've expanded the functionality to allow using slices and fancy indexing to specify specific points to plot the markers with. This avoids having to plot two series (the line, and the markers) when putting a marker on a custom subset of points. Goes someway to addressing:
https://github.com/matplotlib/matplotlib/issues/1981
http://stackoverflow.com/questions/5318639/matplotlib-ugly-plots-when-using-markers
http://stackoverflow.com/questions/17406758/plotting-a-curve-with-equidistant-arc-length-markers
http://stackoverflow.com/questions/2040306/plot-with-fewer-markers-than-data-points-or-a-better-way-to-plot-cdfs-matplo
http://stackoverflow.com/questions/8409095/matplotlib-set-markers-for-individual-points-on-a-line

for example:

```
import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(0,8,35)
y = np.sin(x)
plt.plot(x,y,'o', ls='-')
plt.plot(x,y+1,'s', ls='-', markevery = 4) #old functionality
plt.plot(x,y+2,'^', ls='-', markevery = [2,4]) #old functionality
plt.plot(x,y+3,'h', ls='-', markevery=[4,7,12,15,16]) #new functionality
plt.plot(x,y+4,'+', ls='-', markevery=slice(4,9,2)) #new functionality
plt.show()
```
![figure_1](https://f.cloud.github.com/assets/4219951/1702134/95d7f642-6082-11e3-924d-af639d7e03be.png)