<commit_before>"""
This module serves as an interface to
matplotlib.
"""

from utils import config

OFFSET = 2 # offset = max_x/stepsize * OFFSET

def init(output):
    import matplotlib
    config.mpl(matplotlib, bool(output))
    from matplotlib import pyplot
    globals()['plt'] = pyplot

def line_plot(xs, ys, color='red'):
	plt.plot(
        xs,
        ys,
        color=color,
        linewidth=2.0
    )

def legend(*args):
    plt.legend(args, loc='best')

def scatter_plot(x, y, color='blue'):
	plt.scatter(x, y, color=color)

def scale_x_plot(max_x, stepsize):
    offset = max_x/stepsize * OFFSET
    plt.axis(xmin=-offset, xmax=max_x+offset)

def scale_y_plot(max_y, stepsize):
    offset = max_y/stepsize * OFFSET
    plt.axis(ymin=-offset, ymax=max_y+offset)

def prepare_plot(xlabel, ylabel, title):
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.title(title)
    plt.grid(True)

def display_plot(output):
    if output:
        if output == 'stdout':
            plt.savefig(sys.stdout, format='png')
        else:
            plt.savefig(output)
    else:
        plt.show()<commit_msg>Remove unused `--output stdout` option<commit_after>"""
This module serves as an interface to
matplotlib.
"""

from utils import config

OFFSET = 2 # offset = max_x/stepsize * OFFSET

def init(output):
    import matplotlib
    config.mpl(matplotlib, bool(output))
    from matplotlib import pyplot
    globals()['plt'] = pyplot

def line_plot(xs, ys, color='red'):
	plt.plot(
        xs,
        ys,
        color=color,
        linewidth=2.0
    )

def legend(*args):
    plt.legend(args, loc='best')

def scatter_plot(x, y, color='blue'):
	plt.scatter(x, y, color=color)

def scale_x_plot(max_x, stepsize):
    offset = max_x/stepsize * OFFSET
    plt.axis(xmin=-offset, xmax=max_x+offset)

def scale_y_plot(max_y, stepsize):
    offset = max_y/stepsize * OFFSET
    plt.axis(ymin=-offset, ymax=max_y+offset)

def prepare_plot(xlabel, ylabel, title):
    plt.xlabel(xlabel)
    plt.ylabel(ylabel)
    plt.title(title)
    plt.grid(True)

def display_plot(output):
    if output:
        plt.savefig(output)
    else:
        plt.show()
{'fraction_non_alphanumeric': 0.13023255813953488, 'fraction_numerical': 0.0027906976744186047, 'mean_word_length': 3.1686046511627906, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '1723656', 'n_tokens_mistral': 796, 'n_tokens_neox': 779, 'n_words': 171}