<jupyter_start><jupyter_text>Matplotlib snippets<jupyter_code>def load_2D_dataset():
    from imageio import imread
    plt.rcParams['figure.figsize'] = (10.0, 5.0)
    
    # Data
    data = scipy.io.loadmat('./datasets/data.mat')
    train_X = data['X'].T
    train_Y = data['y'].T
    test_X = data['Xval'].T
    test_Y = data['yval'].T

    # Add background - zorder=0
    background = './images/field_kiank.png'
    img = imread(background)
    plt.imshow(img, zorder=0, extent=[-1., 1., -1, 1.])
    
    # Scatter on top - zorder=1
    plt.scatter(train_X[0, :], train_X[1, :], c=np.squeeze(train_Y), s=40, cmap=plt.cm.Spectral, zorder=1);
    
    # Stretch x-axis: 1/0.6
    plt.gca().set_aspect(aspect=0.6)
    
    # Hide axis
    plt.axis('off')
    return train_X, train_Y, test_X, test_Y
!pip freeze<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16963226571767498, 'fraction_numerical': 0.027283511269276393, 'mean_word_length': 3.0382775119617227, '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': '373868', 'license': 'MIT', 'n_tokens_mistral': 365, 'n_tokens_neox': 351, 'n_words': 58, 'path': '_visualisations/matplotlib_snippets.ipynb', 'repo_name': 'aixpact/data-science', 'size': '843'}