<h3 dir="auto">Bug report</h3>
<p dir="auto">When using log scale with a scatter plot the axes are not set correctly if there is a zero value in the data.</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="import matplotlib.pyplot as plt

x=[1e4, 1e5, 1e6, 0]
y=[1, 1, 1, 1]

fig, ax = plt.subplots()

ax.scatter(x, y, marker='o')
ax.set_xscale('log')
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>

<span class="pl-s1">x</span><span class="pl-c1">=</span>[<span class="pl-c1">1e4</span>, <span class="pl-c1">1e5</span>, <span class="pl-c1">1e6</span>, <span class="pl-c1">0</span>]
<span class="pl-s1">y</span><span class="pl-c1">=</span>[<span class="pl-c1">1</span>, <span class="pl-c1">1</span>, <span class="pl-c1">1</span>, <span class="pl-c1">1</span>]

<span class="pl-s1">fig</span>, <span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">subplots</span>()

<span class="pl-s1">ax</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">'o'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_xscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<p dir="auto">The first point does not appear in the plot:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3267619/94882671-f28a4a00-04ab-11eb-99ff-83fc5c2f3a1d.png"><img src="https://user-images.githubusercontent.com/3267619/94882671-f28a4a00-04ab-11eb-99ff-83fc5c2f3a1d.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto"><strong>Expected outcome</strong></p>
<p dir="auto">Expected all the points to be inside the axis limits as it appears when using <code class="notranslate">plot</code> instead of <code class="notranslate">scatter</code>:</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/3267619/94882748-25ccd900-04ac-11eb-8b4a-cf8e14b8f575.png"><img src="https://user-images.githubusercontent.com/3267619/94882748-25ccd900-04ac-11eb-8b4a-cf8e14b8f575.png" alt="image" style="max-width: 100%;"></a></p>


<p dir="auto"><strong>Matplotlib version</strong></p>

<ul dir="auto">
<li>Operating system: MacOS</li>
<li>Matplotlib version: 3.3.2</li>
<li>Matplotlib backend: Both MacOS and Jupyter <code class="notranslate">module://ipykernel.pylab.backend_inline</code></li>
<li>Python version: 3.8.5</li>
<li>Jupyter version (if applicable): 6.1.4</li>
<li>Other libraries: N/A</li>
</ul>
<p dir="auto">Python and matplotlib installed with conda in a fresh environment<br>
<code class="notranslate">conda create --name matplotlib-log-scatter-bug matplotlib jupyter</code></p>
<p dir="auto">I installed the 3.2.0rc3 package, and I can confirm that this fixes almost all the issues with autoscaling and <code class="notranslate">scatter</code>.  However, if you have points with 0 for the y-axis and enable log scaling there is still an issue with the scatter plot auto scaling (that doesn't show up with the standard <code class="notranslate">plot</code> function).</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import itertools

import numpy as np
from matplotlib import pyplot as plt


x_vals = [4.38462e-06,
          5.54929e-06,
          7.02332e-06,
          8.88889e-06,
          1.125e-05,
          1.42383e-05,
          1.80203e-05,
          2.2807e-05,
          2.88651e-05,
          3.65324e-05,
          4.62363e-05,
          5.85178e-05,
          7.40616e-05,
          9.37342e-05,
          0.000118632,
          ]

y_vals = [0.0,
          0.10000000000000002,
          0.182,
          0.332,
          0.604,
          1.1,
          2.0,
          3.64,
          6.64,
          12.100000000000001,
          22.0,
          39.60000000000001,
          71.3,
          ]

pts = np.array(list(itertools.product(x_vals, y_vals)))

fig = plt.figure(&quot;Scatter plot&quot;)
ax = fig.gca()
ax.set_xscale('log')
ax.set_yscale('log')
ax.scatter(pts[:,0], pts[:,1]) # This only shows four rows of points

fig = plt.figure(&quot;Regular plot&quot;)
ax = fig.gca()
ax.set_xscale('log')
ax.set_yscale('log')
ax.plot(pts[:,0], pts[:,1], marker=&quot;o&quot;, ls=&quot;&quot;) # This works

plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">itertools</span>

<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">import</span> <span class="pl-s1">pyplot</span> <span class="pl-k">as</span> <span class="pl-s1">plt</span>


<span class="pl-s1">x_vals</span> <span class="pl-c1">=</span> [<span class="pl-c1">4.38462e-06</span>,
          <span class="pl-c1">5.54929e-06</span>,
          <span class="pl-c1">7.02332e-06</span>,
          <span class="pl-c1">8.88889e-06</span>,
          <span class="pl-c1">1.125e-05</span>,
          <span class="pl-c1">1.42383e-05</span>,
          <span class="pl-c1">1.80203e-05</span>,
          <span class="pl-c1">2.2807e-05</span>,
          <span class="pl-c1">2.88651e-05</span>,
          <span class="pl-c1">3.65324e-05</span>,
          <span class="pl-c1">4.62363e-05</span>,
          <span class="pl-c1">5.85178e-05</span>,
          <span class="pl-c1">7.40616e-05</span>,
          <span class="pl-c1">9.37342e-05</span>,
          <span class="pl-c1">0.000118632</span>,
          ]

<span class="pl-s1">y_vals</span> <span class="pl-c1">=</span> [<span class="pl-c1">0.0</span>,
          <span class="pl-c1">0.10000000000000002</span>,
          <span class="pl-c1">0.182</span>,
          <span class="pl-c1">0.332</span>,
          <span class="pl-c1">0.604</span>,
          <span class="pl-c1">1.1</span>,
          <span class="pl-c1">2.0</span>,
          <span class="pl-c1">3.64</span>,
          <span class="pl-c1">6.64</span>,
          <span class="pl-c1">12.100000000000001</span>,
          <span class="pl-c1">22.0</span>,
          <span class="pl-c1">39.60000000000001</span>,
          <span class="pl-c1">71.3</span>,
          ]

<span class="pl-s1">pts</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>(<span class="pl-en">list</span>(<span class="pl-s1">itertools</span>.<span class="pl-en">product</span>(<span class="pl-s1">x_vals</span>, <span class="pl-s1">y_vals</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-s">"Scatter plot"</span>)
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">gca</span>()
<span class="pl-s1">ax</span>.<span class="pl-en">set_xscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_yscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">scatter</span>(<span class="pl-s1">pts</span>[:,<span class="pl-c1">0</span>], <span class="pl-s1">pts</span>[:,<span class="pl-c1">1</span>]) <span class="pl-c"># This only shows four rows of points</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-s">"Regular plot"</span>)
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">fig</span>.<span class="pl-en">gca</span>()
<span class="pl-s1">ax</span>.<span class="pl-en">set_xscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">set_yscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-s1">pts</span>[:,<span class="pl-c1">0</span>], <span class="pl-s1">pts</span>[:,<span class="pl-c1">1</span>], <span class="pl-s1">marker</span><span class="pl-c1">=</span><span class="pl-s">"o"</span>, <span class="pl-s1">ls</span><span class="pl-c1">=</span><span class="pl-s">""</span>) <span class="pl-c"># This works</span>

<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><em>Originally posted by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/moloney/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/moloney">@moloney</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="134320068" data-permission-text="Title is private" data-url="https://github.com/matplotlib/matplotlib/issues/6015" data-hovercard-type="issue" data-hovercard-url="/matplotlib/matplotlib/issues/6015/hovercard?comment_id=586488762&amp;comment_type=issue_comment" href="https://github.com/matplotlib/matplotlib/issues/6015#issuecomment-586488762">#6015 (comment)</a></em></p>