<jupyter_start><jupyter_text>Plot results from the questionnaire<jupyter_code>%load_ext autoreload
%autoreload 2
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
votes_user_study_1 = [
    [3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5],
    [2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5],
    [2, 3, 3, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
]
votes_user_study_2 = [
    [3, 4, 4, 4, 5, 5],
    [4, 4, 5, 5, 5, 5],
    [2, 4, 4, 4, 4, 5],
    [2, 3, 3, 4, 4, 5],
    [1, 1, 1, 2, 3, 3],
    [1, 2, 4],
    [2, 3, 4],
    [4, 4, 5, 5, 5, 5],
    [4, 5, 5, 5, 5, 5],
]
def create_violin_plot(data, xtick_labels, name, show_scatter=False):
    ngroup = len(data)
    
    plt.figure(figsize=(ngroup * 0.8,1.25))
    
    plt.axhline(y=5, color='#aaaaaa', linestyle='dotted', linewidth=1, zorder=-1)
    plt.axhline(y=4, color='#aaaaaa', linestyle='dotted', linewidth=1, zorder=-1)
    plt.axhline(y=3, color='#aaaaaa', linestyle='dotted', linewidth=1, zorder=-1)
    plt.axhline(y=2, color='#aaaaaa', linestyle='dotted', linewidth=1, zorder=-1)
    
    parts = plt.violinplot(
        data,
        showmeans=True,
        showmedians=False,
        showextrema=False,
    )
    
    parts['cmeans'].set_color('#000000')
    
    for pc in parts['bodies']:
        pc.set_facecolor('#aaaaaa')
        pc.set_alpha(1)

    if show_scatter:
        for i in range(ngroup):
            y = data[i]
            x = np.random.normal(1+i, 0.04, size=len(y))
            plt.plot(x, y, 'r.', alpha=0.2)

    plt.gca().spines['top'].set_visible(False)
    plt.gca().spines['right'].set_visible(False)
    plt.gca().spines['left'].set_visible(False)
    plt.gca().spines['bottom'].set_color('k')
    plt.ylim(1, 5)
    plt.margins(0.025)
    plt.xticks(range(1, ngroup + 1), xtick_labels)
    plt.yticks(range(1, 6))
    plt.savefig("{}.svg".format(name))
create_violin_plot(votes_user_study_1, ['Q1', 'Q2', 'Q3'], 'user-study-1-survey-results')
create_violin_plot(votes_user_study_2, ['Q1', 'Q2', 'Q3', 'Q5', 'Q6', 'Q7A', 'Q7B', 'Q9', 'Q10'], 'user-study-2-survey-results')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.20174632352941177, 'fraction_numerical': 0.0739889705882353, 'mean_word_length': 3.130929791271347, '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': '297041', 'license': 'MIT', 'n_tokens_mistral': 1076, 'n_tokens_neox': 954, 'n_words': 217, 'path': 'experiment/questionnaire.ipynb', 'repo_name': 'flekschas/higlass-scalable-insets', 'size': '2176'}