Plot high-low with Seaborn, Pandas
<p>I have a pandas dataframe that has by category three data points: mean, max, min.</p>

<p>I'd like to plot these such that the mean is a dot and the max/min are a line.  Similar to a high/low/close graph in stocks, or even just error bars.</p>

<p>For the sake of conversation, assume my code looks like</p>

<pre><code>df = pd.DataFrame({'day': ['M', 'T', 'W', 'F'],
              'foo' : [1,2,3,4],
              'foo_max' : [5,5,6,7],
              'foo_min' : [0,1,1,1]})

sns.stripplot(df.day, df.foo, color='black')
plt.show()
</code></pre>

<p>You could do it this way:</p>

<pre><code>df.set_index('day', inplace=True)

# tsplot with error bars
ax = sns.tsplot([df['foo_max'], df['foo_min']], err_style="ci_bars", 
                interpolate=False, color='g')

ax.set_xticks(np.arange(0, df.shape[0]))
ax.set_xticklabels(df.index) 
ax.set_ylim(0, df.values.max()+1)
sns.plt.show()
</code></pre>

<p><a href="http://i.stack.imgur.com/MVU7E.png" rel="nofollow"><img src="http://i.stack.imgur.com/MVU7E.png" alt="enter image description here"></a></p>

python pandas data-visualization seaborn