I have a DataFrame with a MultiIndex:
# -*- coding: utf-8 -*-
import numpy as np
import pandas as pd
# dataframe with dates
dates = pd.DataFrame()
dates[\'2
I just found another solution to plot with much less code directly from pandas (without having to manipulate the matplotlib-object afterwards):
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
df = pd.DataFrame(np.random.rand(10, 5), columns=['A', 'B', 'C', 'D', 'E'])
ax = df.plot(kind='box',
color=dict(boxes='r', whiskers='r', medians='r', caps='r'),
boxprops=dict(linestyle='-', linewidth=1.5),
flierprops=dict(linestyle='-', linewidth=1.5),
medianprops=dict(linestyle='-', linewidth=1.5),
whiskerprops=dict(linestyle='-', linewidth=1.5),
capprops=dict(linestyle='-', linewidth=1.5),
showfliers=False, grid=True, rot=0)
ax.set_xlabel('Foo')
ax.set_ylabel('Bar in X')
plt.show()
yields:
The only thing I haven't figured out is how to adjust the color of the means when showmeans=True
. But in most cases this should be fine..
Hope it helps!