tadd figsize parameter - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
(HTM) git clone git://src.adamsgaard.dk/sphere
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) LICENSE
---
(DIR) commit 79e929cf878cfeb92124cb866ddc68e370d2da35
(DIR) parent b132b8e081446a24acbf6d1dfe4c7ed810b9234f
(HTM) Author: Anders Damsgaard <anders.damsgaard@geo.au.dk>
Date: Thu, 16 Apr 2015 09:58:52 +0200
add figsize parameter
Diffstat:
M python/sphere.py | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/python/sphere.py b/python/sphere.py
t@@ -5991,7 +5991,8 @@ class sim:
def visualize(self, method='energy', savefig=True, outformat='png',
- pickle=False, xlim=False, firststep=0, f_min=None, f_max=None):
+ figsize=False, pickle=False, xlim=False, firststep=0, f_min=None,
+ f_max=None):
'''
Visualize output from the simulation, where the temporal progress is
of interest. The output will be saved in the current folder with a name
t@@ -6007,6 +6008,8 @@ class sim:
:type savefig: bool
:param outformat: The output format of the plot data. This can be an
image format, or in text ('txt').
+ :param figsize: Specify output figure size in inches
+ :type figsize: array
:param pickle: Save all figure content as a Python pickle file. It can
be opened later using `fig = pickle.load(open('file.pickle','rb'))`.
:type pickle: bool
t@@ -6022,10 +6025,16 @@ class sim:
### Plotting
if outformat != 'txt':
- fig = plt.figure(figsize=(8,8))
+ if figsize:
+ fig = plt.figure(figsize=figsize)
+ else:
+ fig = plt.figure(figsize=(8,8))
if method == 'energy':
- fig = plt.figure(figsize=(20,8))
+ if figsize:
+ fig = plt.figure(figsize=figsize)
+ else:
+ fig = plt.figure(figsize=(20,8))
# Allocate arrays
t = numpy.zeros(lastfile-firststep)
t@@ -6494,7 +6503,10 @@ class sim:
# Plot stresses
if outformat != 'txt':
- fig = plt.figure(figsize=(8,12))
+ if figsize:
+ fig = plt.figure(figsize=figsize)
+ else:
+ fig = plt.figure(figsize=(8,12))
#shearinfo = "$\\tau_p$ = {:.3} Pa at $\gamma$ = {:.3}".format(\
#self.tau_p, self.tau_p_shearstrain)
t@@ -6606,7 +6618,10 @@ class sim:
elif method == 'rate-dependence':
- fig = plt.figure(figsize=(8,6))
+ if figsize:
+ fig = plt.figure(figsize=figsize)
+ else:
+ fig = plt.figure(figsize=(8,6))
tau = numpy.empty(sb.status())
N = numpy.empty(sb.status())
t@@ -6721,7 +6736,10 @@ class sim:
elif method == 'fluid-pressure':
- fig = plt.figure(figsize=(8,6))
+ if figsize:
+ fig = plt.figure(figsize=figsize)
+ else:
+ fig = plt.figure(figsize=(8,6))
sb.readfirst(verbose=False)