July 2016
Beginner to intermediate
462 pages
9h 14m
English
Violin plots combine box plots and kernel density plots or histograms in one type of plot. Seaborn and matplotlib both offer violin plots. We will use Seaborn in this recipe on z-scores of weather data. The z-scoring is not essential, but without it, the violins will be more spread out.
import seaborn as sns from dautil import data import matplotlib.pyplot as plt
df = data.Weather.load() zscores = (df - df.mean())/df.std()
%matplotlib inline
plt.figure()
plt.title('Weather Violin Plot')
sns.violinplot(zscores.resample('M'))
plt.ylabel('Z-scores')Refer ...