Created
February 18, 2018 17:29
-
-
Save erthalion/7fc5b389228690f458d9ac253a775924 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
import glob | |
import json | |
from matplotlib import rc, rcParams | |
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) | |
rc('text', usetex=True) | |
rcParams['text.latex.preamble'] = [r"\usepackage{amsmath}"] | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from scipy.interpolate import spline | |
threads = [1, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100] | |
pg_throughput = [] | |
mysql_throughput = [] | |
mongo_throughput = [] | |
threads_smooth = np.linspace(1, 100, 100) | |
pg_data_smooth = spline(threads, pg_throughput, threads_smooth) | |
mysql_data_smooth = spline(threads, mysql_throughput, threads_smooth) | |
mongo_data_smooth = spline(threads, mongo_throughput, threads_smooth) | |
plt.rc('font', weight='bold') | |
ax = plt.subplot() | |
ax.set_axis_bgcolor("#eaeaf2") | |
ax.grid(color='#ffffff', linestyle='-') | |
for spine in ax.spines.values(): | |
spine.set_visible(False) | |
ax.plot(threads_smooth, pg_data_smooth, '#8172b2', label="PG", linewidth=4) | |
ax.plot(threads_smooth, mysql_data_smooth, '#55a868', label='MySQL', linewidth=4) | |
ax.plot(threads_smooth, mongo_data_smooth, '#c44e52', label='MongoDB', linewidth=4) | |
bbox_props = dict(boxstyle="round", fc="white", ec="k", lw=2) | |
plt.tick_params( | |
axis="both", | |
which="both", | |
bottom="off", | |
left="off", | |
top="off", | |
right="off", | |
labelsize=18, | |
) | |
legend = ax.legend(shadow=True, loc="upper left", bbox_to_anchor=(1,1)) | |
plt.title("Throughput (ops/sec)", fontsize=30, y=1.06) | |
plt.savefig("throughput.png", bbox_extra_artists=(legend,), bbox_inches='tight') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment