def plot_benchmark(x, y, title, x_label="dataset size", y_label="avg. time in s"):
    Based on: mlinspect/experiments/performance/performance_benchmarks.ipynb
    figure, axis = plt.subplots()

    axis.set_yscale('log')  # sets the scale to be logarithmic with powers of 10

    axis.plot(y, marker='8', color='blue', markersize=3)
    # for marker type see:
    # plot function:
    # first arguments set y_value range , x is set to 0..N-1 for now

    axis.set_xticks(range(0, len(x)))
    # set values regarding x - tick stand for 'small vertical lines' on the x-Axis

    axis.set(xlabel=x_label, ylabel=y_label)
    axis.grid(True, color='lightgrey')

    figure.savefig("./benchmark_plots/" + title + ".png", bbox_inches='tight', dpi=800)

downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter