<p dir="auto">To help us understand and resolve your issue please check that you have provided<br>
the information below.</p>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> Matplotlib version, Python version and Platform (Windows, OSX, Linux ...)<br>
osx, linux. Matloplib version 1.5.3. Python version 3.5.2</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> How did you install Matplotlib and Python (pip, anaconda, from source ...)<br>
anaconda (osx/linux), macports (osx)</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> If possible please supply a <a href="http://sscce.org/" rel="nofollow">Short, Self Contained, Correct, Example</a><br>
that demonstrates the issue i.e a small piece of code which reproduces the issue<br>
and can be run with out any other (or as few as possible) external dependencies.<br>
Enclosed</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> If this is an image generation bug attach a screenshot demonstrating the issue.<br>
Attached</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> If this is a regression (Used to work in an earlier version of Matplotlib), please<br>
note where it used to work.<br>
N/A</li>
</ul>
<p dir="auto">==<br>
When plotting numpy's maskedarray with plot(), I could not see some data points.<br>
A simple code follows.  If I savefig() to png file, it works. If I savefig() to pdf (or eps) file, it does not.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import numpy as np
arr = np.array([1, 5, -3, -3, 5, -3, -3, 2, -3, -3, 7, -3, -3, 2])
arrm = np.ma.masked_less(arr, 0)
plt.figure()
plt.plot(arrm, 'o')
plt.savefig('a.png')
plt.savefig('a.pdf')"><pre class="notranslate"><code class="notranslate">import matplotlib.pyplot as plt
import numpy as np
arr = np.array([1, 5, -3, -3, 5, -3, -3, 2, -3, -3, 7, -3, -3, 2])
arrm = np.ma.masked_less(arr, 0)
plt.figure()
plt.plot(arrm, 'o')
plt.savefig('a.png')
plt.savefig('a.pdf')
</code></pre></div>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/6485215/20787595/ff72490c-b7ac-11e6-8f05-0965d0591648.png"><img src="https://cloud.githubusercontent.com/assets/6485215/20787595/ff72490c-b7ac-11e6-8f05-0965d0591648.png" alt="a" style="max-width: 100%;"></a><br>
<a href="https://github.com/matplotlib/matplotlib/files/624078/a.pdf">a.pdf</a></p>
<p dir="auto">Dear developers,<br>
when plotting single points surrounded by np.nan values, points are shown in a regular plot, but are omitted when saved via pdf backend. Minimal example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib.pyplot as plt

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

plt.plot(a, marker='o')
plt.show()"><pre class="notranslate"><code class="notranslate">import numpy as np
import matplotlib.pyplot as plt

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

plt.plot(a, marker='o')
plt.show()
</code></pre></div>
<p dir="auto">generates a perfect plot with the 5 points shown:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/17202381/19445433/881a8df0-9494-11e6-853f-893cd63f80f7.png"><img src="https://cloud.githubusercontent.com/assets/17202381/19445433/881a8df0-9494-11e6-853f-893cd63f80f7.png" alt="foo1" style="max-width: 100%;"></a></p>
<p dir="auto">but directly saving it via pdf backend omitts the values isolated by np.nans:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf as pdf

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

fig1 = plt.figure()
sub  = fig1.add_subplot(1,1,1)
sub.plot(a,marker='o')
pp1  = pdf.PdfPages('foo.pdf')
fig1.savefig(pp1, format='pdf')
pp1.close()"><pre class="notranslate"><code class="notranslate">import numpy as np
import matplotlib.pyplot as plt
import matplotlib.backends.backend_pdf as pdf

a = np.array([1,np.nan,2,np.nan,3,3.5,4])

fig1 = plt.figure()
sub  = fig1.add_subplot(1,1,1)
sub.plot(a,marker='o')
pp1  = pdf.PdfPages('foo.pdf')
fig1.savefig(pp1, format='pdf')
pp1.close()
</code></pre></div>
<p dir="auto">like so:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://cloud.githubusercontent.com/assets/17202381/19445554/0130e8d8-9495-11e6-9a31-a6b70719b87d.png"><img src="https://cloud.githubusercontent.com/assets/17202381/19445554/0130e8d8-9495-11e6-9a31-a6b70719b87d.png" alt="foo2" style="max-width: 100%;"></a></p>
<p dir="auto">I would be glad for any help.</p>
<p dir="auto">System:<br>
Ubuntu 14.02<br>
Python 2.7.6<br>
Numpy 1.11.2<br>
Matplotlib 1.5.3</p>