tadd shading during stick periods - sphere - GPU-based 3D discrete element meth… | |
git clone git://src.adamsgaard.dk/sphere | |
Log | |
Files | |
Refs | |
LICENSE | |
--- | |
commit 4da059b618b35b112bd4e4237cd778555a22e408 | |
parent ecd8f6dc1811cd39492ca4deb409c92572d25df2 | |
Author: Anders Damsgaard <[email protected]> | |
Date: Tue, 10 Feb 2015 21:46:55 +0100 | |
add shading during stick periods | |
Diffstat: | |
M python/sphere.py | 12 +++++++++++- | |
1 file changed, 11 insertions(+), 1 deletion(-) | |
--- | |
diff --git a/python/sphere.py b/python/sphere.py | |
t@@ -4,6 +4,7 @@ import numpy | |
import matplotlib | |
matplotlib.use('Agg') | |
import matplotlib.pyplot as plt | |
+import matplotlib.collections | |
matplotlib.rcParams.update({'font.size': 18, 'font.family': 'serif'}) | |
matplotlib.rc('text', usetex=True) | |
matplotlib.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"] | |
t@@ -5503,7 +5504,7 @@ class sim: | |
fig = plt.figure(figsize=(8,8)) | |
if method == 'energy': | |
- fig = plt.figure(figsuze=(20,8)) | |
+ fig = plt.figure(figsize=(20,8)) | |
# Allocate arrays | |
Epot = numpy.zeros(lastfile+1) | |
t@@ -6003,6 +6004,15 @@ class sim: | |
ax5 = plt.subplot(3, 1, 2, sharex=ax1) | |
ax5.semilogy(time[1:], self.v[1:], label='Shear velocity') | |
ax5.set_ylabel('Shear velocity [ms$^{-1}$]') | |
+ | |
+ # shade stick periods | |
+ collection = \ | |
+ matplotlib.collections.BrokenBarHCollection.span_where( | |
+ time, ymin=1.0e-7, ymax=1.0, | |
+ where=numpy.isclose(self.v, 0.0), | |
+ facecolor='black', alpha=0.2, | |
+ linewidth=0) | |
+ ax5.add_collection(collection) | |
# Lower plot | |
ax3 = plt.subplot(3, 1, 3, sharex=ax1) |