<jupyter_start><jupyter_text>Box Plots<jupyter_code># Generate some Normal distributions with different properties
rands1 = np.random.normal(size=500)
rands2 = np.random.normal(scale=2, size=500)
rands3 = np.random.normal(loc=1, scale=0.5, size=500)
gaussians = (rands1, rands2, rands3)
# Basic Boxplot
plt.boxplot(gaussians);
# Labels
plt.boxplot(gaussians, labels=("first", "second", "third"));
# Box widths
plt.boxplot(gaussians, widths=(0.1,0.5,0.7));
# Horizontal boxes w/ vert
plt.boxplot(gaussians, vert=False);
# Outliers w/ sym
plt.boxplot(gaussians, sym='');<jupyter_output><empty_output><jupyter_text>Violin Plots<jupyter_code># Some other kinds of distributions
rands4 = np.random.lognormal(size=500, sigma=0.5)
rands5 = np.random.pareto(size=500, a=5)
dists = (rands1, rands4, rands5)
# Basic Violin plot
plt.violinplot(dists);
# Show Median & Means
plt.violinplot(dists, showmeans=True, showmedians=True);
# Getting the components
vplot = plt.violinplot(dists, showmedians=True, showmeans=True)
vplot['cmedians'].set_color(('b', 'g', 'k'))
vplot['bodies'][0].set_color('k')
vplot['bodies'][1].set_color('g')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16420503909643788, 'fraction_numerical': 0.035621198957428324, 'mean_word_length': 8.0, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '185815', 'license': 'MIT', 'n_tokens_mistral': 480, 'n_tokens_neox': 457, 'n_words': 83, 'path': 'Chapter03/Statistical Plots.ipynb', 'repo_name': 'PacktPublishing/Mastering-Matplotlib-2.x', 'size': '1151'}