<jupyter_start><jupyter_text>Matplotlib<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
def create_random_data():
    N = 1000
    data1 = np.random.normal(0, 0.1, N)
    data2 = (np.random.normal(1, 0.4, N) + np.linspace(0, 1, N))
    data3 = 2 + (np.random.random(N) * np.linspace(1, 5, N))
    data4 = (np.random.normal(3, 0.2, N) + 0.3 * np.sin(np.linspace(0, 20, N)))
    
    data = np.vstack([data1, data2, data3, data4])
    data = data.transpose()
    
    cols = ['data1', 'data2', 'data3', 'data4']

    df = pd.DataFrame(data, columns=cols)
    return df
df = create_random_data()
df.plot(title='Line plot');
df.plot(style='.', title='Scatter Plot');
df.plot(kind='hist',
        bins=50,
        title='Histogram',
        alpha=0.6);
df.plot(kind='hist',
        bins=100,
        title='Cumulative distributions',
        density=True,
        cumulative=True,
        alpha=0.4);
df.plot(kind='box',
        title='Boxplot');
fig, ax = plt.subplots(2, 2, figsize=(16,12))

df.plot(ax=ax[0][0],
        title='Line plot')

df.plot(ax=ax[0][1],
        style='o',
        title='Scatter plot')

df.plot(ax=ax[1][0],
        kind='hist',
        bins=50,
        title='Histogram')

df.plot(ax=ax[1][1],
        kind='box',
        title='Boxplot');
categories = df['data1'] > 0.01
counts = categories.value_counts()
counts
counts.plot(kind='pie',
            figsize=(5, 5),
            explode=[0, 0.15],
            labels=['<= 0.1', '> 0.1'],
            autopct='%1.1f%%',
            shadow=True,
            startangle=90,
            fontsize=16);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18632788868723532, 'fraction_numerical': 0.04839685420447671, 'mean_word_length': 2.65929203539823, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '273209', 'license': 'MIT', 'n_tokens_mistral': 663, 'n_tokens_neox': 632, 'n_words': 117, 'path': 'day_1/Lab_03_DA Matplotlib.ipynb', 'repo_name': 'sekharhanumanthu/deeplearning', 'size': '1653'}