diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-05 14:00:07 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-05 14:00:07 -0500 |
commit | 4b1bc75d1b3a4edd6e129a52ec7385a2042c99a0 (patch) | |
tree | 1ff00f5b9d9d90bda411390afc9a20f4d35f0185 | |
parent | 9292c084167c93aacbe33050ce4bceb95f07de4a (diff) | |
download | qolab-4b1bc75d1b3a4edd6e129a52ec7385a2042c99a0.tar.gz qolab-4b1bc75d1b3a4edd6e129a52ec7385a2042c99a0.zip |
added plot in separate subplots for sameX trace
-rw-r--r-- | qolab/data/trace.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 624ff46..623b2af 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -71,10 +71,17 @@ class TraceSetSameX: def plot(self): import matplotlib.pyplot as plt + nplots = len(self.traces.keys()) + cnt=0 for k, tr in self.traces.items(): + cnt+=1 + if cnt == 1: + ax1=plt.subplot(nplots, 1, cnt) + else: + plt.subplot(nplots, 1, cnt, sharex=ax1) plt.plot(self.x.values, tr.values, label=tr.label) - plt.xlabel(self.x.label) - plt.legend() + plt.xlabel(self.x.label) + plt.legend() def items(self): return (self.traces.items()) |