Examples

In [1]:
import numpy as np
import pandas as pd
In [3]:
df = pd.DataFrame({'lab':['P', 'Q', 'R'], 'val':[20, 40, 30]})
ax = df.plot.barh(x='lab', y='val')

Plot a whole DataFrame to a horizontal bar plot:

In [4]:
speed = [0.1, 20.5, 50, 68, 72, 89, 98]
lifespan = [2, 10, 70, 5.5, 35, 22, 38]
index = ['snail', 'goat', 'elephant',
         'dog', 'cat', 'fox', 'horse']
df = pd.DataFrame({'speed': speed,
                   'lifespan': lifespan}, index=index)
ax = df.plot.barh()

Plot a column of the DataFrame to a horizontal bar plot

In [5]:
speed = [0.1, 20.5, 50, 68, 72, 89, 98]
lifespan = [2, 10, 70, 5.5, 35, 22, 38]
index = ['snail', 'goat', 'elephant',
         'dog', 'cat', 'fox', 'horse']
df = pd.DataFrame({'speed': speed,
                   'lifespan': lifespan}, index=index)
ax = df.plot.barh(y='speed')

Plot DataFrame versus the desired column:

In [6]:
speed = [0.1, 20.5, 50, 68, 72, 89, 98]
lifespan = [2, 10, 70, 5.5, 35, 22, 38]
index = ['snail', 'goat', 'elephant',
         'dog', 'cat', 'fox', 'horse']
df = pd.DataFrame({'speed': speed,
                   'lifespan': lifespan}, index=index)
ax = df.plot.barh(x='lifespan')