<p dir="auto">Reported also in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="42008671" data-permission-text="Title is private" data-url="https://github.com/mwaskom/seaborn/issues/282" data-hovercard-type="issue" data-hovercard-url="/mwaskom/seaborn/issues/282/hovercard" href="https://github.com/mwaskom/seaborn/issues/282">mwaskom/seaborn#282</a></p>
<p dir="auto">Environment: OS X Mavericks<br>
Anaconda python distribution (python 2.7.8)<br>
IPython 2.2.0<br>
Seaborn 0.4</p>
<p dir="auto">In an ipython terminal or qtconsole, it works with running</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="n [1]: %matplotlib
Using matplotlib backend: MacOSX

In [2]: from pylab import *

In [3]: plot(range(5))
Out[3]: [&lt;matplotlib.lines.Line2D at 0x10d73dd50&gt;]"><pre class="notranslate">n [1]: %matplotlib
Using matplotlib backend: MacOSX

In [2]: from pylab import <span class="pl-k">*</span>

In [3]: plot(range(5))
Out[3]: [<span class="pl-k">&lt;</span>matplotlib.lines.Line2D at 0x10d73dd<span class="pl-k">50&gt;</span>]</pre></div>
<p dir="auto">However, after importing seaborn, the macosx backend breaks</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="In [4]: import seaborn as sns

In [5]: plot(range(5))
Out[5]: [&lt;matplotlib.lines.Line2D at 0x10c10eb90&gt;]

In [6]: Traceback (most recent call last):
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/figure.py&quot;, line 1079, in draw
    func(*args)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axes/_base.py&quot;, line 2092, in draw
    a.draw(renderer)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py&quot;, line 59, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axis.py&quot;, line 1105, in draw
    renderer)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axis.py&quot;, line 1054, in _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/text.py&quot;, line 741, in get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/text.py&quot;, line 311, in _get_layout
    ismath=False)
  File &quot;/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py&quot;, line 166, in get_text_width_height_descent
    six.text_type(s), family, size, weight, style)
TypeError: bad argument type for built-in operation"><pre class="notranslate">In [4]: import seaborn as sns

In [5]: plot(range(5))
Out[5]: [<span class="pl-k">&lt;</span>matplotlib.lines.Line2D at 0x10c10eb<span class="pl-k">90&gt;</span>]

In [6]: Traceback (most recent call last):
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py<span class="pl-pds">"</span></span>, line 59, <span class="pl-k">in</span> draw_wrapper
    draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/figure.py<span class="pl-pds">"</span></span>, line 1079, <span class="pl-k">in</span> draw
    func(<span class="pl-k">*</span>args)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py<span class="pl-pds">"</span></span>, line 59, <span class="pl-k">in</span> draw_wrapper
    draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axes/_base.py<span class="pl-pds">"</span></span>, line 2092, <span class="pl-k">in</span> draw
    a.draw(renderer)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/artist.py<span class="pl-pds">"</span></span>, line 59, <span class="pl-k">in</span> draw_wrapper
    draw(artist, renderer, <span class="pl-k">*</span>args, <span class="pl-k">**</span>kwargs)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axis.py<span class="pl-pds">"</span></span>, line 1105, <span class="pl-k">in</span> draw
    renderer)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/axis.py<span class="pl-pds">"</span></span>, line 1054, <span class="pl-k">in</span> _get_tick_bboxes
    extent = tick.label1.get_window_extent(renderer)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/text.py<span class="pl-pds">"</span></span>, line 741, <span class="pl-k">in</span> get_window_extent
    bbox, info, descent = self._get_layout(self._renderer)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/text.py<span class="pl-pds">"</span></span>, line 311, <span class="pl-k">in</span> _get_layout
    ismath=False)
  File <span class="pl-s"><span class="pl-pds">"</span>/Users/zhangxiaowei/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py<span class="pl-pds">"</span></span>, line 166, <span class="pl-k">in</span> get_text_width_height_descent
    six.text_type(s), family, size, weight, style)
TypeError: bad argument <span class="pl-c1">type</span> <span class="pl-k">for</span> built-in operation</pre></div>
<p dir="auto">Interestingly, using <code class="notranslate">%matplotlib inline</code> in an IPython notebook works fine. Also, using another backend such as "Qt4Agg" works fine in IPython terminal or qtconsole.</p>
<p dir="auto">After downgrading matplotlib to 1.3.1, the issue goes away.</p>
<h3 dir="auto">Bug report</h3>
<p dir="auto"><strong>Bug summary</strong></p>
<p dir="auto">axes3D.zaxis.set_major_formatter(mpl.dates.DateFormatter("%Y/%m")) couldn't show datetime axis correctly. It report ValueError: year is out of range.</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 as mpl
from mpl_toolkits.mplot3d import Axes3D
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from datetime import datetime
import time

mpl.rcParams['legend.fontsize'] = 10

fig = plt.figure()
ax = fig.gca(projection='3d')

SJ = pd.to_datetime(['2017/1/1 0:03:36','2017/1/1 0:33:36','2017/1/1 1:03:36'])

for i in np.arange(0, 3, 1):
  x=[ii for ii in np.arange(0,20,1)]
  y=[np.sin(ii) for ii in np.arange(0,20,1)]
  z= SJ[i].timestamp()
  print(str(z)+':'+str(datetime.fromtimestamp(z)))
  # print(datetime.fromordinal(int(z/60/24)))
  ax.plot(x, y, z)

ax.zaxis.set_major_formatter(mpl.dates.DateFormatter(&quot;%Y/%m/%d/%H&quot;))
plt.show()"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">matplotlib</span> <span class="pl-k">as</span> <span class="pl-s1">mpl</span>
<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-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-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">from</span> <span class="pl-s1">datetime</span> <span class="pl-k">import</span> <span class="pl-s1">datetime</span>
<span class="pl-k">import</span> <span class="pl-s1">time</span>

<span class="pl-s1">mpl</span>.<span class="pl-s1">rcParams</span>[<span class="pl-s">'legend.fontsize'</span>] <span class="pl-c1">=</span> <span class="pl-c1">10</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">gca</span>(<span class="pl-s1">projection</span><span class="pl-c1">=</span><span class="pl-s">'3d'</span>)

<span class="pl-v">SJ</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-en">to_datetime</span>([<span class="pl-s">'2017/1/1 0:03:36'</span>,<span class="pl-s">'2017/1/1 0:33:36'</span>,<span class="pl-s">'2017/1/1 1:03:36'</span>])

<span class="pl-k">for</span> <span class="pl-s1">i</span> <span class="pl-c1">in</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>, <span class="pl-c1">3</span>, <span class="pl-c1">1</span>):
  <span class="pl-s1">x</span><span class="pl-c1">=</span>[<span class="pl-s1">ii</span> <span class="pl-k">for</span> <span class="pl-s1">ii</span> <span class="pl-c1">in</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>,<span class="pl-c1">20</span>,<span class="pl-c1">1</span>)]
  <span class="pl-s1">y</span><span class="pl-c1">=</span>[<span class="pl-s1">np</span>.<span class="pl-en">sin</span>(<span class="pl-s1">ii</span>) <span class="pl-k">for</span> <span class="pl-s1">ii</span> <span class="pl-c1">in</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">0</span>,<span class="pl-c1">20</span>,<span class="pl-c1">1</span>)]
  <span class="pl-s1">z</span><span class="pl-c1">=</span> <span class="pl-v">SJ</span>[<span class="pl-s1">i</span>].<span class="pl-en">timestamp</span>()
  <span class="pl-en">print</span>(<span class="pl-en">str</span>(<span class="pl-s1">z</span>)<span class="pl-c1">+</span><span class="pl-s">':'</span><span class="pl-c1">+</span><span class="pl-en">str</span>(<span class="pl-s1">datetime</span>.<span class="pl-en">fromtimestamp</span>(<span class="pl-s1">z</span>)))
  <span class="pl-c"># print(datetime.fromordinal(int(z/60/24)))</span>
  <span class="pl-s1">ax</span>.<span class="pl-en">plot</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>, <span class="pl-s1">z</span>)

<span class="pl-s1">ax</span>.<span class="pl-s1">zaxis</span>.<span class="pl-en">set_major_formatter</span>(<span class="pl-s1">mpl</span>.<span class="pl-s1">dates</span>.<span class="pl-v">DateFormatter</span>(<span class="pl-s">"%Y/%m/%d/%H"</span>))
<span class="pl-s1">plt</span>.<span class="pl-en">show</span>()</pre></div>
<p dir="auto"><strong>Actual outcome</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1483200216.0:2017-01-01 00:03:36
1483202016.0:2017-01-01 00:33:36
1483203816.0:2017-01-01 01:03:36
Exception in Tkinter callback
Traceback (most recent call last):
  File &quot;C:\Program Files\Anaconda3\lib\tkinter\__init__.py&quot;, line 1550, in __call__
    return self.func(*args)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py&quot;, line 280, in resize
    self.show()
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py&quot;, line 351, in draw
    FigureCanvasAgg.draw(self)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py&quot;, line 464, in draw
    self.figure.draw(self.renderer)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\artist.py&quot;, line 63, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\figure.py&quot;, line 1144, in draw
    renderer, self, dsu, self.suppressComposite)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\image.py&quot;, line 139, in _draw_list_compositing_images
    a.draw(renderer)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py&quot;, line 290, in draw
    ax.draw(renderer)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axis3d.py&quot;, line 258, in draw
    for i, val in enumerate(majorLocs)]
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axis3d.py&quot;, line 258, in &lt;listcomp&gt;
    for i, val in enumerate(majorLocs)]
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py&quot;, line 466, in __call__
    dt = num2date(x, self.tz)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py&quot;, line 401, in num2date
    return _from_ordinalf(x, tz)
  File &quot;C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py&quot;, line 254, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)
ValueError: year is out of range
[Finished in 4.8s]"><pre class="notranslate"><code class="notranslate">1483200216.0:2017-01-01 00:03:36
1483202016.0:2017-01-01 00:33:36
1483203816.0:2017-01-01 01:03:36
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Program Files\Anaconda3\lib\tkinter\__init__.py", line 1550, in __call__
    return self.func(*args)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 280, in resize
    self.show()
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 351, in draw
    FigureCanvasAgg.draw(self)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py", line 464, in draw
    self.figure.draw(self.renderer)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\artist.py", line 63, in draw_wrapper
    draw(artist, renderer, *args, **kwargs)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\figure.py", line 1144, in draw
    renderer, self, dsu, self.suppressComposite)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\image.py", line 139, in _draw_list_compositing_images
    a.draw(renderer)
  File "C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py", line 290, in draw
    ax.draw(renderer)
  File "C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axis3d.py", line 258, in draw
    for i, val in enumerate(majorLocs)]
  File "C:\Program Files\Anaconda3\lib\site-packages\mpl_toolkits\mplot3d\axis3d.py", line 258, in &lt;listcomp&gt;
    for i, val in enumerate(majorLocs)]
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py", line 466, in __call__
    dt = num2date(x, self.tz)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py", line 401, in num2date
    return _from_ordinalf(x, tz)
  File "C:\Program Files\Anaconda3\lib\site-packages\matplotlib\dates.py", line 254, in _from_ordinalf
    dt = datetime.datetime.fromordinal(ix).replace(tzinfo=UTC)
ValueError: year is out of range
[Finished in 4.8s]
</code></pre></div>
<p dir="auto"><strong>Expected outcome</strong></p>


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

<ul dir="auto">
<li>Operating System: windows 7 x64</li>
<li>Matplotlib Version: 2.02</li>
<li>Python Version:python 3.5.2 |Anaconda 4.2.0 （64bit）| [MCS v.1900 64 bit ] on win32</li>
<li>Jupyter Version (if applicable):</li>
<li>Other Libraries:</li>
</ul>