tsave plot as PDF - slidergrid - grid of elastic sliders on a frictional surface
(HTM) git clone git://src.adamsgaard.dk/slidergrid
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 2186c59a2858b1645b8f09a0cea58e87358aeda0
(DIR) parent 64ff0d3cc5fff3d9f05502d7db911e75ebc1731d
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Wed, 30 Mar 2016 13:56:15 -0700
save plot as PDF
Diffstat:
M postprocessing.py | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/postprocessing.py b/postprocessing.py
t@@ -37,7 +37,7 @@ class sgvis:
def plot_sliders(self):
plt.plot(self.sliders[:, 0], self.sliders[:, 1], '+')
- outfile = self.folder + '/' + self.filename + '.png'
+ outfile = self.folder + '/' + self.filename + '.pdf'
print(outfile)
plt.savefig(outfile)
plt.clf()
t@@ -46,12 +46,32 @@ class sgvis:
for filename in os.listdir(self.folder):
if 'sliders' in filename \
and '.txt' in filename \
+ and '.pdf' not in filename \
and '.png' not in filename:
self.read_sliders(filename)
self.plot_sliders()
+ def current_time(self):
+ return 0.0
+
+ def current_kinetic_energy(self):
+ return 0.0
+
def plot_kinetic_energy(self):
- pass
+ t = []
+ E_kin = []
+ for filename in os.listdir(self.folder):
+ if 'sliders' in filename \
+ and '.txt' in filename \
+ and '.png' not in filename:
+ self.read_sliders(filename)
+ E_kin.append(self.current_kinetic_energy)
+
+ plt.plot(t, E_kin)
+ outfile = self.folder + '/E_kin.pdf'
+ print(outfile)
+ plt.savefig(outfile)
+ plt.clf()
def iterate_over_folders_and_files(folders,
plot_sliders,