<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong><br>
When using loglog plot for plotting gain/phase vs. frequency and setting yticks and labels, the ylim([min max]) writes as powers, whereas I try to set the end-points in whole numbers.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import numpy as np
import matplotlib.pyplot as plt

freq = np.linspace(20, 20e3, 1000) # Frequency vector

# Generate gain vector
gain = []
for frequency in freq:
    gain.append(27.4)
gain = np.array(gain)

fig = plt.figure(dpi=300)
plt.yscale('log')
plt.xticks([20, 100, 1000, 10000, 20000], ['20', '100', '1k', '10k', '20k'])

plt.loglog(freq, gain, color='red', lw=1.3)


ytickval = []
yticknotate = []
for i in range(20, 31):
    ytickval.append(i)
    yticknotate.append(str(i))

plt.yticks(ytickval, yticknotate)
plt.xlim(20, 75000)
plt.ylim(20,30)
plt.show()"><pre class="notranslate"><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">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">freq</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">20</span>, <span class="pl-c1">20e3</span>, <span class="pl-c1">1000</span>) <span class="pl-c"># Frequency vector</span>

<span class="pl-c"># Generate gain vector</span>
<span class="pl-s1">gain</span> <span class="pl-c1">=</span> []
<span class="pl-k">for</span> <span class="pl-s1">frequency</span> <span class="pl-c1">in</span> <span class="pl-s1">freq</span>:
    <span class="pl-s1">gain</span>.<span class="pl-en">append</span>(<span class="pl-c1">27.4</span>)
<span class="pl-s1">gain</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">array</span>(<span class="pl-s1">gain</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">dpi</span><span class="pl-c1">=</span><span class="pl-c1">300</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">yscale</span>(<span class="pl-s">'log'</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>([<span class="pl-c1">20</span>, <span class="pl-c1">100</span>, <span class="pl-c1">1000</span>, <span class="pl-c1">10000</span>, <span class="pl-c1">20000</span>], [<span class="pl-s">'20'</span>, <span class="pl-s">'100'</span>, <span class="pl-s">'1k'</span>, <span class="pl-s">'10k'</span>, <span class="pl-s">'20k'</span>])

<span class="pl-s1">plt</span>.<span class="pl-en">loglog</span>(<span class="pl-s1">freq</span>, <span class="pl-s1">gain</span>, <span class="pl-s1">color</span><span class="pl-c1">=</span><span class="pl-s">'red'</span>, <span class="pl-s1">lw</span><span class="pl-c1">=</span><span class="pl-c1">1.3</span>)


<span class="pl-s1">ytickval</span> <span class="pl-c1">=</span> []
<span class="pl-s1">yticknotate</span> <span class="pl-c1">=</span> []
<span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-en">range</span>(<span class="pl-c1">20</span>, <span class="pl-c1">31</span>):
    <span class="pl-s1">ytickval</span>.<span class="pl-en">append</span>(<span class="pl-s1">i</span>)
    <span class="pl-s1">yticknotate</span>.<span class="pl-en">append</span>(<span class="pl-en">str</span>(<span class="pl-s1">i</span>))

<span class="pl-s1">plt</span>.<span class="pl-en">yticks</span>(<span class="pl-s1">ytickval</span>, <span class="pl-s1">yticknotate</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">xlim</span>(<span class="pl-c1">20</span>, <span class="pl-c1">75000</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">ylim</span>(<span class="pl-c1">20</span>,<span class="pl-c1">30</span>)
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/22648097/51820000-afd69e80-22d4-11e9-818c-fd5a786ac10c.png"><img src="https://user-images.githubusercontent.com/22648097/51820000-afd69e80-22d4-11e9-818c-fd5a786ac10c.png" alt="error" style="max-width: 100%;"></a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="
**Expected outcome**
The expected outcome is end-points (20dB and 30dB) written as 20 and 30 respectively, instead of 2*10^1 and 3*10^1

**Matplotlib version**
&lt;!--Please specify your platform and versions of the relevant libraries you are using:--&gt;
  * Operating system: Windows 10 Education
  * Matplotlib version:  3.0.2
  * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg
  * Python version: 3.6.8 (anaconda)
  * Jupyter version (if applicable): 4.4.0
  * Other libraries: Numpy

&lt;!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--&gt;
&lt;!--If you installed from conda, please specify which channel you used if not the default--&gt;
Used the default conda channel."><pre class="notranslate"><code class="notranslate">
**Expected outcome**
The expected outcome is end-points (20dB and 30dB) written as 20 and 30 respectively, instead of 2*10^1 and 3*10^1

**Matplotlib version**
&lt;!--Please specify your platform and versions of the relevant libraries you are using:--&gt;
  * Operating system: Windows 10 Education
  * Matplotlib version:  3.0.2
  * Matplotlib backend (`print(matplotlib.get_backend())`): Qt5Agg
  * Python version: 3.6.8 (anaconda)
  * Jupyter version (if applicable): 4.4.0
  * Other libraries: Numpy

&lt;!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--&gt;
&lt;!--If you installed from conda, please specify which channel you used if not the default--&gt;
Used the default conda channel.
</code></pre></div>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">Setting axis ticks in a small log scale produces duplicate tick labels.</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
fig, ax = plt.subplots()
s = 10
ax.axis([s, 100, 10, 100])
ax.loglog([20, 30], [30, 40])
from matplotlib.ticker import ScalarFormatter
for axis in [ax.xaxis, ax.yaxis]:
    axis.set_major_formatter(ScalarFormatter())

ax.set_xticks([20, 55])
ax.set_yticks([20, 55])
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">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">s</span> <span class="pl-c1">=</span> <span class="pl-c1">10</span>
<span class="pl-s1">ax</span>.<span class="pl-en">axis</span>([<span class="pl-s1">s</span>, <span class="pl-c1">100</span>, <span class="pl-c1">10</span>, <span class="pl-c1">100</span>])
<span class="pl-s1">ax</span>.<span class="pl-en">loglog</span>([<span class="pl-c1">20</span>, <span class="pl-c1">30</span>], [<span class="pl-c1">30</span>, <span class="pl-c1">40</span>])
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">ticker</span> <span class="pl-k">import</span> <span class="pl-v">ScalarFormatter</span>
<span class="pl-k">for</span> <span class="pl-s1">axis</span> <span class="pl-c1">in</span> [<span class="pl-s1">ax</span>.<span class="pl-s1">xaxis</span>, <span class="pl-s1">ax</span>.<span class="pl-s1">yaxis</span>]:
    <span class="pl-s1">axis</span>.<span class="pl-en">set_major_formatter</span>(<span class="pl-v">ScalarFormatter</span>())

<span class="pl-s1">ax</span>.<span class="pl-en">set_xticks</span>([<span class="pl-c1">20</span>, <span class="pl-c1">55</span>])
<span class="pl-s1">ax</span>.<span class="pl-en">set_yticks</span>([<span class="pl-c1">20</span>, <span class="pl-c1">55</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/6657200/42314213-26c86c36-8077-11e8-853e-47a387d7d72a.png"><img src="https://user-images.githubusercontent.com/6657200/42314213-26c86c36-8077-11e8-853e-47a387d7d72a.png" alt="figure_1" style="max-width: 100%;"></a></p>

<p dir="auto"><strong>change code a little bit</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
fig, ax = plt.subplots()
s = 9
ax.axis([s, 100, 10, 100])
ax.loglog([20, 30], [30, 40])
from matplotlib.ticker import ScalarFormatter
for axis in [ax.xaxis, ax.yaxis]:
    axis.set_major_formatter(ScalarFormatter())
ax.set_xticks([20, 55])
ax.set_yticks([20, 55])
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">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">s</span> <span class="pl-c1">=</span> <span class="pl-c1">9</span>
<span class="pl-s1">ax</span>.<span class="pl-en">axis</span>([<span class="pl-s1">s</span>, <span class="pl-c1">100</span>, <span class="pl-c1">10</span>, <span class="pl-c1">100</span>])
<span class="pl-s1">ax</span>.<span class="pl-en">loglog</span>([<span class="pl-c1">20</span>, <span class="pl-c1">30</span>], [<span class="pl-c1">30</span>, <span class="pl-c1">40</span>])
<span class="pl-k">from</span> <span class="pl-s1">matplotlib</span>.<span class="pl-s1">ticker</span> <span class="pl-k">import</span> <span class="pl-v">ScalarFormatter</span>
<span class="pl-k">for</span> <span class="pl-s1">axis</span> <span class="pl-c1">in</span> [<span class="pl-s1">ax</span>.<span class="pl-s1">xaxis</span>, <span class="pl-s1">ax</span>.<span class="pl-s1">yaxis</span>]:
    <span class="pl-s1">axis</span>.<span class="pl-en">set_major_formatter</span>(<span class="pl-v">ScalarFormatter</span>())
<span class="pl-s1">ax</span>.<span class="pl-en">set_xticks</span>([<span class="pl-c1">20</span>, <span class="pl-c1">55</span>])
<span class="pl-s1">ax</span>.<span class="pl-en">set_yticks</span>([<span class="pl-c1">20</span>, <span class="pl-c1">55</span>])
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Expected outcome</strong><br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/6657200/42314434-91b84156-8077-11e8-8409-aac5a95962c4.png"><img src="https://user-images.githubusercontent.com/6657200/42314434-91b84156-8077-11e8-8409-aac5a95962c4.png" alt="figure_2" style="max-width: 100%;"></a></p>


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

<ul dir="auto">
<li>Operating system: Ubuntu 16.04</li>
<li>Matplotlib version: 2.2.2</li>
<li>Matplotlib backend: Qt5Agg</li>
<li>Python version: 3.6</li>
</ul>