Created
November 22, 2013 13:39
-
-
Save AndiH/7599973 to your computer and use it in GitHub Desktop.
simple pyplot + prettyplotlib example
This file contains hidden or 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
| import numpy as np #numerical stuff | |
| import pylab as pl #for poly line fit | |
| import sys | |
| import prettyplotlib as ppl # makes nicer colors and generally better to look at graphs | |
| from prettyplotlib import plt # This is "import matplotlib.pyplot as plt" from the prettyplotlib library | |
| from prettyplotlib import mpl # This is "import matplotlib as mpl" from the prettyplotlib library | |
| # change font to Open Sans (has some kerning issues, though) | |
| mpl.rcParams.update({'font.family':'Open Sans'}) | |
| # get name of file to process | |
| inputFileName = sys.argv[1] | |
| # load csv file with EPOCHTIME;NOFPROCESSES | |
| data = np.loadtxt(inputFileName, delimiter=";") | |
| # fig, ax = plt.subplots(figsize=(14,8)) #shorthand | |
| fig = plt.figure(figsize=(7,4)) | |
| ax = fig.add_subplot(1, 1, 1) | |
| ppl.plot(ax, data[:,0], data[:,3], label="Unbunched", linewidth=2) | |
| ppl.plot(ax, data[:,0], data[:,4], label="Bunched", linewidth=2) | |
| # ax.set_xticks(printList) | |
| # ax.set_xticklabels(humanName); | |
| ax.set_xlabel("Number of Hits") | |
| ax.set_ylabel("Performance / Mhits/s") | |
| ax.axis('tight') | |
| # ax.set_yscale('log') | |
| # ax.set_xscale('log') | |
| ax.grid(axis='y', color='0.3', linestyle=':', antialiased=True) | |
| # position of ticks | |
| ppl.legend(ax, loc=0) | |
| # fig.savefig('chromeProcessesPerTime.png', dpi=200) | |
| fig.savefig('bunchedvsunbunched_python.pdf', dpi=50, bbox_inches='tight') | |
| # fig.savefig('chromeProcessesPerTime.svg', dpi=200) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment