<h3 dir="auto">Bug summary</h3>
<p dir="auto">See title</p>
<h3 dir="auto">Code for reproduction</h3>
<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
X = np.random.randn(100, 5)
ax = plt.figure().subplots()
ax.boxplot(X, patch_artist=True)
assert ax.artists"><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-v">X</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-s1">random</span>.<span class="pl-en">randn</span>(<span class="pl-c1">100</span>, <span class="pl-c1">5</span>)
<span class="pl-s1">ax</span> <span class="pl-c1">=</span> <span class="pl-s1">plt</span>.<span class="pl-en">figure</span>().<span class="pl-en">subplots</span>()
<span class="pl-s1">ax</span>.<span class="pl-en">boxplot</span>(<span class="pl-v">X</span>, <span class="pl-s1">patch_artist</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)
<span class="pl-k">assert</span> <span class="pl-s1">ax</span>.<span class="pl-s1">artists</span></pre></div>
<h3 dir="auto">Actual outcome</h3>
<p dir="auto">AssertionError</p>
<h3 dir="auto">Expected outcome</h3>
<p dir="auto">pass</p>
<h3 dir="auto">Matplotlib Version</h3>
<p dir="auto">3.5.0b1</p>
<h3 dir="auto">Installation</h3>
<p dir="auto">pip</p>
<p dir="auto">I want to be able to set the <code class="notranslate">xticks</code> or <code class="notranslate">yticks</code> based on user input, but I can't seem to do this without invoking an <code class="notranslate">if</code> statement in order to use the default behaviour.</p>
<p dir="auto">To get the default <code class="notranslate">xticks</code> for example, you can run:</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

x = np.linspace(0,1)                                                            

plt.plot(x, x**2)                                                               
plt.xticks()                                                                    
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">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>,<span class="pl-c1">1</span>)                                                            

<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">x</span>, <span class="pl-s1">x</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)                                                               
<span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>()                                                                    
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto">However, if I want a user-set variable to set the <code class="notranslate">xticks</code>, I have to do this:</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

user_option = None

x = np.linspace(0,1)                                                            

plt.plot(x, x**2)
if user_option == None:                                                       
    plt.xticks()
else:
    plt.xticks(user_option)                                                                    
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">user_option</span> <span class="pl-c1">=</span> <span class="pl-c1">None</span>

<span class="pl-s1">x</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">linspace</span>(<span class="pl-c1">0</span>,<span class="pl-c1">1</span>)                                                            

<span class="pl-s1">plt</span>.<span class="pl-en">plot</span>(<span class="pl-s1">x</span>, <span class="pl-s1">x</span><span class="pl-c1">**</span><span class="pl-c1">2</span>)
<span class="pl-k">if</span> <span class="pl-s1">user_option</span> <span class="pl-c1">==</span> <span class="pl-c1">None</span>:                                                       
    <span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>()
<span class="pl-k">else</span>:
    <span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>(<span class="pl-s1">user_option</span>)                                                                    
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto">Since the code <code class="notranslate">plt.xticks(None)</code> gives the following error:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;tmp.py&quot;, line 9, in &lt;module&gt;
    plt.xticks(None)
  File &quot;/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/pyplot.py&quot;, line 1671, in xticks
    locs = ax.set_xticks(args[0])
  File &quot;/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/axes/_base.py&quot;, line 2850, in set_xticks
    ret = self.xaxis.set_ticks(ticks, minor=minor)
  File &quot;/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/axis.py&quot;, line 1595, in set_ticks
    if len(ticks) &gt; 1:
TypeError: object of type 'NoneType' has no len()"><pre class="notranslate"><span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"tmp.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">9</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
    <span class="pl-s1">plt</span>.<span class="pl-en">xticks</span>(<span class="pl-c1">None</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/pyplot.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1671</span>, <span class="pl-s1">in</span> <span class="pl-s1">xticks</span>
    <span class="pl-s1">locs</span> <span class="pl-c1">=</span> <span class="pl-s1">ax</span>.<span class="pl-en">set_xticks</span>(<span class="pl-s1">args</span>[<span class="pl-c1">0</span>])
  <span class="pl-v">File</span> <span class="pl-s">"/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/axes/_base.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">2850</span>, <span class="pl-s1">in</span> <span class="pl-s1">set_xticks</span>
    <span class="pl-s1">ret</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">xaxis</span>.<span class="pl-en">set_ticks</span>(<span class="pl-s1">ticks</span>, <span class="pl-s1">minor</span><span class="pl-c1">=</span><span class="pl-s1">minor</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/home/vanwyk/py_envs/py3/lib/python3.4/site-packages/matplotlib/axis.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1595</span>, <span class="pl-s1">in</span> <span class="pl-s1">set_ticks</span>
    <span class="pl-k">if</span> <span class="pl-en">len</span>(<span class="pl-s1">ticks</span>) <span class="pl-c1">&gt;</span> <span class="pl-c1">1</span>:
<span class="pl-v">TypeError</span>: <span class="pl-s1">object</span> <span class="pl-s1">of</span> <span class="pl-s1">type</span> <span class="pl-s">'NoneType'</span> <span class="pl-s1">has</span> <span class="pl-s1">no</span> <span class="pl-en">len</span>()</pre></div>
<p dir="auto">Could the <code class="notranslate">plt.xticks</code> and <code class="notranslate">plt.yticks</code> functions allow the passing of <code class="notranslate">None</code> to retrieve default behaviour, or is there some way of getting the default ticks while still passing a variable?</p>