├── .gitignore ├── README.md ├── barchart.png ├── barchart.py ├── barchart_stacked.png ├── barchart_stacked.py ├── ethplot.mplstyle ├── heatmap.png ├── heatmap.py ├── heatmap_colorized.png ├── heatmap_colorized.py ├── lineplot.png ├── lineplot.py ├── timeplot.py └── timeseries.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | 55 | # Sphinx documentation 56 | docs/_build/ 57 | 58 | # PyBuilder 59 | target/ 60 | 61 | #Ipython Notebook 62 | .ipynb_checkpoints 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # phdplot 2 | Make nice plots with matplotlib. 3 | 4 | ## Set-up 5 | 6 | On Ubuntu 14.04, install the following packages: 7 | 8 | ``` 9 | $ sudo aptitude install python-tk libfreetype6-dev python-pip 10 | $ sudo pip install matplotlib palettable pandas 11 | ``` 12 | 13 | The sample demos use two custom fonts: Supria Sans and Decima Mono. You can install those in your `.fonts` folder and 14 | afterwards matplotlib should be able to find and use them. 15 | Make sure you update your font cache after if you install new fonts: 16 | ``` 17 | $ fc-cache -vf ~/.fonts/ 18 | ``` 19 | 20 | ## Lineplots 21 | ![alt text](lineplot.png "Lineplot Example") 22 | 23 | ## Barcharts 24 | ![alt text](barchart.png "Barchart Example") 25 | ![alt text](barchart_stacked.png "Stacked Barchart Example") 26 | 27 | ## Heatmaps 28 | ![alt text](heatmap.png "Heatmap Dark") 29 | ![alt text](heatmap_colorized.png "Heatmap Colors") 30 | 31 | ## Timeseries 32 | ![alt text](timeseries.png "Timeseries") 33 | -------------------------------------------------------------------------------- /barchart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/barchart.png -------------------------------------------------------------------------------- /barchart.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | from matplotlib import pyplot as plt, font_manager 3 | import numpy as np 4 | from palettable import colorbrewer 5 | 6 | np.random.seed(0) 7 | 8 | NAME = "barchart" 9 | ticks_font = font_manager.FontProperties(family='Decima Mono') 10 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 11 | 12 | LEFT = -0.035 13 | fig, ax = plt.subplots() 14 | fig.suptitle('A Bar Chart', 15 | horizontalalignment='left', 16 | weight='bold', fontsize=20, 17 | x=LEFT, y=1.078) 18 | fig.text(LEFT, 1.0041, "Scores by group and gender.", 19 | horizontalalignment='left', 20 | weight='medium', fontsize=16, color='#555555') 21 | 22 | N = 5 23 | menMeans = (20, 35, 30, 35, 27) 24 | menStd = (2, 3, 4, 1, 2) 25 | 26 | ind = np.arange(N) # the x locations for the groups 27 | width = 0.35 # the width of the bars 28 | 29 | colors = colorbrewer.diverging.RdYlBu_9.mpl_colors 30 | rects1 = ax.bar(ind, menMeans, width, yerr=menStd, color=colors[1], ecolor='#777777') 31 | 32 | womenMeans = (25, 32, 34, 20, 25) 33 | womenStd = (3, 5, 2, 3, 3) 34 | rects2 = ax.bar(ind+width, womenMeans, width, yerr=womenStd, color=colors[-2], ecolor='#777777') 35 | 36 | # add some text for labels, title and axes ticks 37 | ax.set_ylabel('Scores', rotation='horizontal', horizontalalignment='left') 38 | ax.yaxis.set_label_coords(LEFT, 1.03) 39 | ax.spines['top'].set_visible(False) 40 | ax.spines['right'].set_visible(False) 41 | ax.get_xaxis().tick_bottom() 42 | ax.get_yaxis().tick_left() 43 | ax.xaxis.grid(False) 44 | 45 | ax.set_xticks(ind+width) 46 | ax.set_xticklabels(('Group A', 'Group B', 'Group C', 'Group D', 'Group E'), weight='light') 47 | ax.legend( (rects1[0], rects2[0]), ('Men', 'Women'), prop={ 'weight': 'light' }, ncol=2, bbox_to_anchor=(1.02, 1.1)) 48 | 49 | #plt.setp(ax.get_xticklabels(), fontproperties=ticks_font) 50 | plt.setp(ax.get_yticklabels(), fontproperties=ticks_font) 51 | 52 | def autolabel(rects): 53 | # attach some text labels 54 | for rect in rects: 55 | height = rect.get_height() 56 | t = ax.text(rect.get_x()+rect.get_width()/2., 1.0, '%d'%int(height), 57 | ha='center', va='bottom') 58 | t.set_fontproperties(ticks_font) 59 | 60 | autolabel(rects1) 61 | autolabel(rects2) 62 | 63 | plt.savefig(NAME + ".png", format='png') 64 | -------------------------------------------------------------------------------- /barchart_stacked.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/barchart_stacked.png -------------------------------------------------------------------------------- /barchart_stacked.py: -------------------------------------------------------------------------------- 1 | from matplotlib import pyplot as plt, font_manager 2 | import numpy as np 3 | from palettable import tableau 4 | 5 | ticks_font = font_manager.FontProperties(family='Decima Mono') 6 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 7 | 8 | fig, ax = plt.subplots() 9 | 10 | N = 4 11 | measA = (1.285, 3.904, 0.957, 1.065) 12 | measB = (0.123, 0.228, 2.525, 3.03) 13 | measC = (1.907, 1.972, 1.969, 1.951) 14 | measD = (1.997, 1.996, 1.975, 1.981) 15 | measE = (6.253, 0.253, 5.253, 4.237) 16 | measF = (0.511, 0.208, 1.579, 1.575) 17 | 18 | matrix = [] 19 | matrix.append(measA) 20 | matrix.append(measB) 21 | matrix.append(measC) 22 | matrix.append(measD) 23 | matrix.append(measE) 24 | matrix.append(measF) 25 | 26 | ind = np.arange(N) # the x locations for the groups 27 | width = 0.5 # the width of the bars 28 | 29 | colors = tableau.TableauLight_10.mpl_colors 30 | 31 | rects1 = ax.bar(ind, matrix[0], width, color=colors[0], hatch='/', ec='black') 32 | rects2 = ax.bar(ind, matrix[1], width, bottom=measA ,color=colors[1], hatch='+', ec='black') 33 | rects3 = ax.bar(ind, matrix[2], width, bottom=[measA[i]+measB[i] for i in range(N)] ,color=colors[2], ec='black') 34 | rects4 = ax.bar(ind, matrix[3], width, bottom=[measA[i]+measB[i]+measC[i] for i in range(N)], color=colors[3], hatch='\\', ec='black') 35 | rects5 = ax.bar(ind, matrix[4], width, bottom=[measA[i]+measB[i]+measC[i]+measD[i] for i in range(N)], color=colors[4], hatch='X', ec='black') 36 | rects6 = ax.bar(ind, matrix[5], width, bottom=[measA[i]+measB[i]+measC[i]+measD[i]+measE[i] for i in range(N)], color=colors[5], hatch='|', ec='black') 37 | 38 | #ax.set_ylim([0, 18]) 39 | 40 | ax.set_ylabel('Execution time [s]') 41 | ax.get_xaxis().tick_bottom() 42 | ax.get_yaxis().tick_left() 43 | ax.xaxis.grid(False) 44 | 45 | ax.set_xticks(ind+width/2) 46 | ax.set_xticklabels(('128', '256', '512', '1024'), weight='light') 47 | ax.legend((rects1[0], rects2[0], rects3[0], rects4[0], rects5[0], rects6[0]), 48 | ('partitioning', 'window allocation', 'sorting', 'merging', 'joining', 'imbalance'), 49 | prop={ 'weight': 'light' }, ncol=3, bbox_to_anchor=(1.02, 1.15)) 50 | 51 | plt.setp(ax.get_xticklabels(), fontproperties=ticks_font) 52 | plt.setp(ax.get_yticklabels(), fontproperties=ticks_font) 53 | 54 | def autolabel(rects): 55 | for rect in rects: 56 | height = rect.get_height() 57 | t = ax.text(rect.get_x()+rect.get_width()/2., 1.0, '%d'%int(height), 58 | ha='center', va='bottom') 59 | t.set_fontproperties(ticks_font) 60 | 61 | 62 | plt.savefig("barchart_stacked.png", format='png') 63 | -------------------------------------------------------------------------------- /ethplot.mplstyle: -------------------------------------------------------------------------------- 1 | font.size: 14.0 2 | font.family: sans-serif 3 | font.sans-serif: Supria Sans, Lucida Grande, Bitstream Vera Sans, Helvetica Neue LT Pro 4 | font.style: normal 5 | font.variant: normal 6 | 7 | lines.linewidth: 4 8 | lines.solid_capstyle: butt 9 | 10 | # Don't really want a frame but in case we do we want the fancy one: 11 | legend.frameon: false 12 | legend.fancybox: true 13 | 14 | axes.prop_cycle: cycler('color', ["30a2da", "fc4f30", "e5ae38", "6d904f", "8b8b8b"]) 15 | axes.facecolor: ffffff 16 | axes.edgecolor: cbcbcb 17 | axes.labelsize: large 18 | axes.axisbelow: true 19 | axes.grid: true 20 | axes.linewidth: 2.0 21 | axes.titlesize: x-large 22 | axes.labelweight: light 23 | 24 | # Remove small ticks at the labels, not necessary with grid: 25 | xtick.major.size: 0 26 | ytick.major.size: 0 27 | xtick.minor.size: 0 28 | ytick.minor.size: 0 29 | 30 | # Adds more space between x[0] and y[0] tick labels: 31 | xtick.major.pad: 7 32 | ytick.major.pad: 7 33 | 34 | patch.edgecolor: f0f0f0 35 | patch.linewidth: 0.5 36 | 37 | svg.fonttype: path 38 | 39 | grid.linestyle: - 40 | grid.linewidth: 1.0 41 | grid.color: cbcbcb 42 | 43 | savefig.edgecolor: ffffff 44 | savefig.facecolor: ffffff 45 | savefig.dpi: 300 46 | savefig.bbox: tight 47 | savefig.pad_inches: 0.0 48 | 49 | figure.subplot.left: 0.00 50 | figure.subplot.right: 1.0 51 | figure.subplot.bottom: 0.00 52 | figure.subplot.top: 0.9 53 | #figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots 54 | #figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots 55 | -------------------------------------------------------------------------------- /heatmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/heatmap.png -------------------------------------------------------------------------------- /heatmap.py: -------------------------------------------------------------------------------- 1 | import matplotlib.cm as cm 2 | from matplotlib import pyplot as plt, font_manager 3 | import numpy as np 4 | import pandas as pd 5 | from StringIO import StringIO 6 | import os 7 | import sys 8 | 9 | def heatmap(name, data, title, text): 10 | fig, ax = plt.subplots() 11 | ticks_font = font_manager.FontProperties(family='Decima Mono') 12 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 13 | #savefig.pad_inches: 0.08 14 | 15 | LEFT = 0.125 16 | fig.suptitle(title, 17 | horizontalalignment='left', 18 | weight='bold', fontsize=20, 19 | x=LEFT, y=1) 20 | t = fig.text(LEFT, 0.92, text, 21 | horizontalalignment='left', 22 | weight='medium', fontsize=16, color='#555555') 23 | 24 | labels1 = ['PR','HD','SSSP','SCC'] 25 | labels2 = ['PR','HD','SSSP','SCC'] 26 | 27 | ax.set_xticklabels(labels1) 28 | ax.set_yticklabels(labels2) 29 | ax.set_yticks(np.arange(data.shape[0]) + 0.5) 30 | ax.set_xticks(np.arange(data.shape[1]) + 0.5) 31 | 32 | ax.tick_params(pad=11) 33 | 34 | plt.setp(ax.get_xticklabels(), fontproperties=ticks_font) 35 | plt.setp(ax.get_yticklabels(), fontproperties=ticks_font) 36 | 37 | c = plt.pcolor(data, cmap = cm.Greys, vmin=1.0, vmax=2.5) 38 | 39 | values = data.as_matrix() 40 | for x in range(data.shape[0]): 41 | for y in range(data.shape[1]): 42 | color = 'white' if values[y][x] > 2.3 else 'black' 43 | plt.text(x + 0.5, y + 0.5, '%.2f' % values[y][x], 44 | horizontalalignment='center', 45 | verticalalignment='center', 46 | color=color, 47 | fontproperties=ticks_font) 48 | 49 | colorbar = plt.colorbar(c) 50 | plt.setp(colorbar.ax.get_yticklabels(), fontproperties=ticks_font) 51 | 52 | plt.savefig(name + ".png", format='png') 53 | #ppad_inched=0.08 here because otherwise it cuts off the numbers... 54 | #plt.savefig(name + ".pdf", format='pdf', pad_inches=0.08) 55 | 56 | def main(): 57 | title = "A Heatmap" 58 | text = "Normalized slowdown for a pair of operators." 59 | NAME = "heatmap" 60 | 61 | csv = StringIO("""PR,HD,SSSP,SCC 62 | PR,1.52,1.21,1.16,0.85 63 | HD,2.10,1.40,0.80,1.86 64 | SSSP,2.50,0.71,2.00,0.76 65 | SCC,2.52,1.27,1.70,0.62""") 66 | 67 | data = pd.read_csv(csv, index_col=0) 68 | heatmap(NAME, data, title, text) 69 | 70 | 71 | if __name__ == "__main__": 72 | main() 73 | -------------------------------------------------------------------------------- /heatmap_colorized.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/heatmap_colorized.png -------------------------------------------------------------------------------- /heatmap_colorized.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import matplotlib.cm as cm 4 | from StringIO import StringIO 5 | 6 | from matplotlib import pyplot as plt, font_manager 7 | from matplotlib.colors import Normalize, LinearSegmentedColormap 8 | 9 | colors = LinearSegmentedColormap.from_list('seismic', ["#2ca25f", "#ffffff", "#ca0020"]) 10 | 11 | class MidpointNormalize(Normalize): 12 | def __init__(self, vmin=None, vmax=None, midpoint=None, clip=False): 13 | self.midpoint = midpoint 14 | Normalize.__init__(self, vmin, vmax, clip) 15 | 16 | def __call__(self, value, clip=None): 17 | # I'm ignoring masked values and all kinds of edge cases to make a 18 | # simple example... 19 | x, y = [self.vmin, self.midpoint, self.vmax], [0, 0.5, 1] 20 | return np.ma.masked_array(np.interp(value, x, y)) 21 | 22 | 23 | def heatmap(name, data, title, text): 24 | fig, ax = plt.subplots() 25 | ticks_font = font_manager.FontProperties(family='Decima Mono') 26 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 27 | LEFT = 0.125 28 | fig.suptitle(title, 29 | horizontalalignment='left', 30 | weight='bold', fontsize=20, 31 | x=LEFT, y=1) 32 | t = fig.text(LEFT, 0.92, text, 33 | horizontalalignment='left', 34 | weight='medium', fontsize=16, color='#555555') 35 | 36 | labels1 = ['PR','HD','SSSP','SCC'] 37 | labels2 = ['PR','HD','SSSP','SCC'] 38 | ax.set_xticklabels(labels1) 39 | ax.set_yticklabels(labels2) 40 | ax.set_yticks(np.arange(data.shape[0]) + 0.5) 41 | ax.set_xticks(np.arange(data.shape[1]) + 0.5) 42 | 43 | ax.tick_params(pad=11) 44 | 45 | plt.setp(ax.get_xticklabels(), fontproperties=ticks_font) 46 | plt.setp(ax.get_yticklabels(), fontproperties=ticks_font) 47 | 48 | norm = MidpointNormalize(midpoint=1.0) 49 | c = plt.pcolor(data, cmap = colors, vmin=0.5, vmax=2.5, norm=norm) 50 | 51 | values = data.as_matrix() 52 | for x in range(data.shape[0]): 53 | for y in range(data.shape[1]): 54 | #color = 'white' if values[y][x] > 2.3 else 'black' 55 | color = 'black' 56 | plt.text(x + 0.5, y + 0.5, '%.2f' % values[y][x], 57 | horizontalalignment='center', 58 | verticalalignment='center', 59 | color=color, 60 | fontproperties=ticks_font) 61 | 62 | colorbar = plt.colorbar(c) 63 | plt.setp(colorbar.ax.get_yticklabels(), fontproperties=ticks_font) 64 | 65 | plt.savefig(name + ".png", format='png') 66 | #ppad_inched=0.08 here because otherwise it cuts off the numbers... 67 | #plt.savefig(name + ".pdf", format='pdf', pad_inches=0.08) 68 | 69 | def main(): 70 | title = "A Heatmap" 71 | text = "Normalized slowdown for a pair of operators." 72 | 73 | NAME = "heatmap_colorized" 74 | csv = StringIO("""PR,HD,SSSP,SCC 75 | PR,1.52,1.21,1.16,0.85 76 | HD,2.10,1.40,0.80,1.86 77 | SSSP,2.50,0.71,2.00,0.76 78 | SCC,2.52,1.27,1.70,0.62""") 79 | 80 | data = pd.read_csv(csv, index_col=0) 81 | heatmap(NAME, data, title, text) 82 | 83 | if __name__ == "__main__": 84 | main() 85 | -------------------------------------------------------------------------------- /lineplot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/lineplot.png -------------------------------------------------------------------------------- /lineplot.py: -------------------------------------------------------------------------------- 1 | from matplotlib import pyplot as plt, font_manager 2 | import numpy as np 3 | 4 | np.random.seed(0) 5 | 6 | NAME = "lineplot" 7 | ticks_font = font_manager.FontProperties(family='Decima Mono') 8 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 9 | 10 | fig = plt.figure() 11 | 12 | LEFT = -0.035 13 | 14 | fig.suptitle('Key-value System Throughput', 15 | horizontalalignment='left', 16 | weight='bold', fontsize=20, 17 | x=LEFT, y=1.078) 18 | fig.text(LEFT, 1.0041, "While increasing the amount of SET requests.", 19 | horizontalalignment='left', 20 | weight='medium', fontsize=16, color='#555555') 21 | 22 | ax1 = fig.add_subplot(1, 1, 1) 23 | ax1.set_xlabel('SET rate [%]') 24 | ax1.set_ylabel('Requests / s', rotation 25 | ='horizontal', horizontalalignment='left') 26 | ax1.yaxis.set_label_coords(LEFT-0.005, 1.03) 27 | ax1.spines['top'].set_visible(False) 28 | ax1.spines['right'].set_visible(False) 29 | ax1.get_xaxis().tick_bottom() 30 | ax1.get_yaxis().tick_left() 31 | 32 | x = np.linspace(0, 10) 33 | 34 | y = np.sin(x) + 0.5 * x + np.random.randn(50) 35 | p = ax1.plot(x, y, label="System A") 36 | ax1.annotate('System A', xy=(x[-5], y[-5]), xytext=(x[-5], y[-5]-2.8), weight='light', color=p[0].get_color()) 37 | 38 | y = np.sin(x) + x + np.random.randn(50) 39 | p = ax1.plot(x, y, label="System B") 40 | ax1.annotate('System B', xy=(x[-5], y[-5]), xytext=(x[-5], y[-5]+1.6), weight='light', color=p[0].get_color()) 41 | 42 | y = np.sin(x) + 2 * x + np.random.randn(50) 43 | p = ax1.plot(x, y, label="System C") 44 | ax1.annotate('System C', xy=(x[-5], y[-5]), xytext=(x[-5], y[-5]+1.0), weight='light', color=p[0].get_color()) 45 | 46 | y = np.sin(x) + 3 * x + np.random.randn(50) 47 | p = ax1.plot(x, y, label="System D") 48 | ax1.annotate('System D', xy=(x[-5], y[-5]), xytext=(x[-5], y[-5]-1.7), weight='light', color=p[0].get_color()) 49 | 50 | y = np.sin(x) + 4 * x + np.random.randn(50) 51 | p = ax1.plot(x, y, label="System E") 52 | ax1.annotate('System E', xy=(x[-5], y[-5]), xytext=(x[-5], y[-5]-1.3), weight='light', color=p[0].get_color()) 53 | 54 | plt.setp(ax1.get_xticklabels(), fontproperties=ticks_font) 55 | plt.setp(ax1.get_yticklabels(), fontproperties=ticks_font) 56 | 57 | plt.savefig(NAME + ".png", format='png') 58 | -------------------------------------------------------------------------------- /timeplot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | import datetime 5 | import numpy as np 6 | 7 | import matplotlib.dates as mdates 8 | from matplotlib import pyplot as plt, font_manager 9 | 10 | NAME = "timeseries" 11 | ticks_font = font_manager.FontProperties(family='Decima Mono') 12 | plt.style.use([os.path.join(sys.path[0], 'ethplot.mplstyle')]) 13 | 14 | DATA = [ 15 | (228542030.21088627, datetime.datetime(2019, 10, 1, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 16 | (221542030.21088627, datetime.datetime(2019, 10, 2, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 17 | (224542030.21088627, datetime.datetime(2019, 10, 3, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 18 | (228542030.21088627, datetime.datetime(2019, 10, 4, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 19 | (228542030.21088627, datetime.datetime(2019, 10, 5, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 20 | (208542030.21088627, datetime.datetime(2019, 10, 6, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 21 | (228542030.21088627, datetime.datetime(2019, 10, 7, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 22 | (248542030.21088627, datetime.datetime(2019, 10, 8, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 23 | (292280856.88659593, datetime.datetime(2019, 10, 8, 22, 11, 5, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200))))] 24 | 25 | DATA2 = [ 26 | (8542030.21088627, datetime.datetime(2019, 10, 1, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 27 | (1542030.21088627, datetime.datetime(2019, 10, 2, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 28 | (4542030.21088627, datetime.datetime(2019, 10, 3, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 29 | (8542030.21088627, datetime.datetime(2019, 10, 4, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 30 | (8542030.21088627, datetime.datetime(2019, 10, 5, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 31 | (8542030.21088627, datetime.datetime(2019, 10, 6, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 32 | (8542030.21088627, datetime.datetime(2019, 10, 7, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 33 | (8542030.21088627, datetime.datetime(2019, 10, 8, 21, 6, 56, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200)))), 34 | (2280856.88659593, datetime.datetime(2019, 10, 8, 22, 11, 5, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=61200))))] 35 | 36 | 37 | fig = plt.figure() 38 | fig.suptitle('Performance History', weight='bold', fontsize=20) 39 | 40 | ax1 = fig.add_subplot(1, 1, 1) 41 | ax1.set_ylabel('Requests / s') 42 | ax1.spines['top'].set_visible(False) 43 | ax1.spines['right'].set_visible(False) 44 | ax1.get_xaxis().tick_bottom() 45 | ax1.get_yaxis().tick_left() 46 | 47 | # Only show last 50 elements 48 | DATA = DATA[-50:] 49 | DATA2 = DATA2[-50:] 50 | 51 | x = mdates.date2num(list(map(lambda x: x[1], DATA))) 52 | y = list(map(lambda x: x[0], DATA)) 53 | ax1.plot_date(x, y, label="Baseline") 54 | 55 | x = mdates.date2num(list(map(lambda x: x[1], DATA2))) 56 | y = list(map(lambda x: x[0], DATA2)) 57 | ax1.plot_date(x, y, label="NR") 58 | ax1.legend(loc='best') 59 | 60 | fig.autofmt_xdate() 61 | plt.setp(ax1.get_xticklabels(), fontproperties=ticks_font) 62 | plt.setp(ax1.get_yticklabels(), fontproperties=ticks_font) 63 | 64 | plt.savefig(NAME + ".png", format='png') 65 | -------------------------------------------------------------------------------- /timeseries.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gz/phdplot/4156dda070d464930196a7c7e249f28a88a35ab4/timeseries.png --------------------------------------------------------------------------------