How to plot timedelta as value with matplotlib
<p>I am trying to plot a duration in seconds with respect to some iteration values. I compute the duration values by substracting two datetime values. Then, I would like to plot these results in a very simple way using existing tools.</p>

<p>My code is the following but it doesn't work yet:</p>

<pre class="lang-py prettyprint-override"><code>#!/usr/bin/env python

import datetime
import matplotlib.pyplot as plt
from numpy import arange

it = arange(10)
durations = [datetime.timedelta(hours=h+30) for h in it]

plt.plot(it, durations)

plt.show()
</code></pre>

<p>I got the following error:</p>

<pre><code>TypeError: float() argument must be a string or a number
</code></pre>

<p>I know that I can make it work by using datetime instead of timedelta but my goal is to plot duration in hours (around 40 hours) so the rendering is not good.</p>