<jupyter_start><jupyter_text>VISUALIZATIONS<jupyter_code>plt.figure(figsize=(20, 8))
hue_order = ["18-30","31-40","41-50","51-60","61-70","71+"]
sns.barplot(x="Parliament", 
            y="Age@Parliament", 
            hue="Age_buckets", 
            data=MP_age,
            hue_order=hue_order)
plt.ylabel("Age@Parliament", size=14)
plt.xlabel("Parliament", size=14)
plt.title("Age buckets per Parliament", size=18)
plt.figure(figsize=(20, 8))
hue_order = ["18-30","31-40","41-50","51-60","61-70","71+"]
sns.lineplot(x="Parliament_Year", 
            y="Age@Parliament", 
            hue="Age_buckets",
            style="Age_buckets",
            data=MP_age,
            markers=True, dashes=False)
#             hue_order=hue_order, markers=True)
plt.ylabel("Age@Parliament", size=14)
plt.xlabel("Parliament", size=14)
plt.title("Age buckets per Parliament", size=18)
plt.figure(figsize=(30, 20))
sns.factorplot(x='Parliament_year', y='Voters_count', hue='Age_buckets', data=data)
sns.factorplot(x='Parliament_year', y='MP_count', hue='Age_buckets', data=data)
plt.figure(figsize=(20, 10))
sns.barplot(x="Parliament_year", hue="Age_buckets", y="Voters_count", data=data)
plt.title("Voters by Age buckets per Parliament", size=18)
plt.show()
plt.figure(figsize=(20, 8))
sns.barplot(data= data,
                x="Parliament_year",
                y="MP_count_%",
                hue="Age_buckets",
                )
plt.title("MPs by Age buckets per Parliament", size=18)

## PLOTS WITH SHARED Y AXIS
# specify plot layouts with different width using subplots()
f, axs = plt.subplots(1,2,
                      figsize=(16,10),
                      sharex=True)
# make scatterplot with legends
sns.barplot(data= data,
                x="Parliament_year",
                y="MP_count",
                hue="Age_buckets",
                ax=axs[0],
                )
# make densityplot with kdeplot without legends
sns.barplot(data= data,
                x="Parliament_year",
                y="Voters_count",
                hue="Age_buckets",
                ax=axs[1])
f.tight_layout()
## PLOTS WITH SHARED Y AXIS
# specify plot layouts with different width using subplots()
for k in data["Parliament_year"].unique():
    
    f, axs = plt.subplots(1,2,
                          figsize=(12,8),
                          sharey=True)
    # make scatterplot with legends
    sns.barplot(data= data[data["Parliament_year"]==k],
                    x="Parliament_year",
                    y="MP_count_%",
                    hue="Age_buckets",
                    ax=axs[0],
                    )
    # make densityplot with kdeplot without legends
    sns.barplot(data= data[data["Parliament_year"]==k],
                    x="Parliament_year",
                    y="Voters_count_%",
                    hue="Age_buckets",
                    ax=axs[1])
    f.tight_layout()
    plt.title("Age buckets (%) at {} Parliament".format(k), size=18)

plt.figure(figsize=(20, 12))
sns.scatterplot(data= data, x="MP_count_%", y="Voters_count_%", hue="Age_buckets");
plt.savefig("MP_vs_Voters_per_Age_bucket_new")

cond_plot = sns.FacetGrid(data=data, col='Parliament_year', hue='Age_buckets', col_wrap=4)
cond_plot.map(sns.scatterplot, 'Voters_count_%', 'MP_count_%');
plt.figure(figsize=(18,10))
sns.stripplot(data = data, x = 'Age_buckets', y = 'MP_count_%')
sns.stripplot(data = data, x = 'Age_buckets', y = 'Voters_count_%', edgecolor="black",
                linewidth=2,sizes=(40,100))

## SWARM PLOT - Along with the number of data points, it also provides their respective distribution.
plt.figure(figsize=(18,10))
sns.swarmplot(data = data, x = 'Age_buckets', y = 'MP_count_%')
sns.swarmplot(data = data, x = 'Age_buckets', y = 'Voters_count_%', edgecolor="black",
                linewidth=2,sizes=(40,100))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1544461778471139, 'fraction_numerical': 0.03094123764950598, 'mean_word_length': 2.862449799196787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '134109', 'license': 'MIT', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1321, 'n_words': 230, 'path': 'Data_Visualizations.ipynb', 'repo_name': 'kolekrstev/FML2021', 'size': '3846'}