-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreate_plot.py
More file actions
31 lines (25 loc) · 883 Bytes
/
create_plot.py
File metadata and controls
31 lines (25 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run this file inside a project directory to create a data-vs-time plot
# out of pickle dumps.
# normally not necessary since the main script will to this periodically
import matplotlib.pyplot as plt
import pickle, os
plotfn = "data_vs_time.pdf"
dlplot_x_fp = 'dlplot_x.pickle'
dlplot_y_fp = 'dlplot_y.pickle'
dlplot_x_fh = open(dlplot_x_fp, 'rb')
dlplot_y_fh = open(dlplot_y_fp, 'rb')
dlplot_x = pickle.load(dlplot_x_fh)
dlplot_y = pickle.load(dlplot_y_fh)
dlplot_x_fh.close()
dlplot_y_fh.close()
# convert to hours and gigabytes
dlplot_x[:] = [x/(60.0*60*24) for x in dlplot_x]
dlplot_y[:] = [y/1024.0 for y in dlplot_y]
# save plot of database size versus elapsed download time
plt.plot(dlplot_x, dlplot_y)
plt.xlabel('Time in days')
plt.ylabel('Folder size in GB')
titlemsg = "Folder size vs elapsed time"
plt.savefig(plotfn)