<h3 dir="auto">Bug report</h3>
<p dir="auto">It seems matplotlib's 3d plot components is not rendering things right. The lines are disappearing at the top of surface plot.</p>
<p dir="auto"><strong>Bug summary</strong></p>

<p dir="auto"><strong>Code for reproduction</strong></p>

<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from mpl_toolkits.mplot3d import Axes3D

kk = 3
sigma = 0.8
t = np.linspace(-kk, kk, 128)
x, y = np.meshgrid(t, t)
f = (1-(x**2+y**2)/2/sigma**2)*np.exp(-(x**2+y**2)/2/sigma**2)/sigma**4

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(x,y, f, rcount=20, ccount=20)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">mpl_toolkits</span>.<span class="pl-s1">mplot3d</span> <span class="pl-k">import</span> <span class="pl-v">Axes3D</span>

<span class="pl-s1">kk</span> <span class="pl-c1">=</span> <span class="pl-c1">3</span>
<span class="pl-s1">sigma</span> <span class="pl-c1">=</span> <span class="pl-c1">0.8</span>
<span class="pl-s1">t</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">-</span><span class="pl-s1">kk</span>, <span class="pl-s1">kk</span>, <span class="pl-c1">128</span>)
<span class="pl-s1">x</span>, <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">meshgrid</span>(<span class="pl-s1">t</span>, <span class="pl-s1">t</span>)
<span class="pl-s1">f</span> <span class="pl-c1">=</span> (<span class="pl-c1">1</span><span class="pl-c1">-</span>(<span class="pl-s1">x</span><span class="pl-c1">**</span><span class="pl-c1">2</span><span class="pl-c1">+</span><span class="pl-s1">y</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)<span class="pl-c1">/</span><span class="pl-c1">2</span><span class="pl-c1">/</span><span class="pl-s1">sigma</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)<span class="pl-c1">*</span><span class="pl-s1">np</span>.<span class="pl-en">exp</span>(<span class="pl-c1">-</span>(<span class="pl-s1">x</span><span class="pl-c1">**</span><span class="pl-c1">2</span><span class="pl-c1">+</span><span class="pl-s1">y</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)<span class="pl-c1">/</span><span class="pl-c1">2</span><span class="pl-c1">/</span><span class="pl-s1">sigma</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)<span class="pl-c1">/</span><span class="pl-s1">sigma</span><span class="pl-c1">**</span><span class="pl-c1">4</span>

<span class="pl-s1">fig</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>()
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">add_subplot</span>(<span class="pl-c1">111</span>, <span class="pl-s1">projection</span><span class="pl-c1">=</span><span class="pl-s">'3d'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">plot_surface</span>(<span class="pl-s1">x</span>,<span class="pl-s1">y</span>, <span class="pl-s1">f</span>, <span class="pl-s1">rcount</span><span class="pl-c1">=</span><span class="pl-c1">20</span>, <span class="pl-s1">ccount</span><span class="pl-c1">=</span><span class="pl-c1">20</span>)</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>

<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/15790176/60379952-4ddeb880-9a6f-11e9-994c-490b594f3855.png"><img src="https://user-images.githubusercontent.com/15790176/60379952-4ddeb880-9a6f-11e9-994c-490b594f3855.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: Windows10</li>
<li>Matplotlib version:  3.1.0</li>
<li>Matplotlib backend (<code class="notranslate">print(matplotlib.get_backend())</code>): Qt5Agg</li>
<li>Python version: 3.7</li>
<li>Jupyter version (if applicable):</li>
<li>Other libraries: numpy</li>
</ul>
<p dir="auto">This is the underlying problem raised in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="6572843" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/1178" data-hovercard-type="pull_request" data-hovercard-url="/matplotlib/matplotlib/pull/1178/hovercard" href="https://github.com/matplotlib/matplotlib/pull/1178">#1178</a>.<br>
It is illustrated by the test below; note that boundary anomalies are visible in all forms--agg on the screen, and pdf and svg displayed with a viewer--but in different places depending on the viewer and the size of the figure as rendered.<br>
Note that the colorbar is rendered using pcolormesh, which has its own renderer with agg but otherwise is handled by draw_path_collection.</p>
<pre class="notranslate">import numpy as np
import matplotlib.pyplot as plt

z = np.arange(150)
z.shape = (10,15)

fig, axs = plt.subplots(2,2)

ax = axs[0,0]
cs0 = ax.contourf(z, 20)
cbar0 = fig.colorbar(cs0, ax=ax)

ax = axs[0,1]
cs1 = ax.contourf(z, 20, alpha=0.3)
cbar1 = fig.colorbar(cs1, ax=ax)

ax = axs[1,0]
im2 = ax.imshow(z, interpolation='nearest')
cbar2 = fig.colorbar(im2, ax=ax)

ax = axs[1,1]
im3 = ax.imshow(z, interpolation='nearest', alpha=0.3)
cbar3 = fig.colorbar(im3, ax=ax)

plt.savefig("test1.pdf")
plt.savefig("test1.svg")
plt.show()
</pre>