diff options
author | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-21 23:17:00 -0500 |
---|---|---|
committer | Eugeniy E. Mikhailov <evgmik@gmail.com> | 2021-12-21 23:17:00 -0500 |
commit | 9e886376eba4dc884ed887fd09062882f7088e8b (patch) | |
tree | c020b05ab0d4b2e0b58d5ee4ffcc2e07a013805f /qolab | |
parent | de2f25925e934537d2dc1b12b26c97b4b4a7066e (diff) | |
download | qolab-9e886376eba4dc884ed887fd09062882f7088e8b.tar.gz qolab-9e886376eba4dc884ed887fd09062882f7088e8b.zip |
redone plotting of TraceSetSameX so it does not show xtics everywhere
Diffstat (limited to 'qolab')
-rw-r--r-- | qolab/data/trace.py | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/qolab/data/trace.py b/qolab/data/trace.py index 681a89a..37387fa 100644 --- a/qolab/data/trace.py +++ b/qolab/data/trace.py @@ -241,21 +241,18 @@ class TraceSetSameX(Trace): def plot(self): import matplotlib.pyplot as plt nplots = len(self.traces.keys()) + fig, axs = plt.subplots(nplots, 1, sharex=True) cnt=0 x=self.x.values if self.x.config['type'] is not None: if self.x.config['type'] == 'timestamp': x = from_timestamps_to_dates(x) for k, tr in self.traces.items(): + p=axs[cnt].plot(x, tr.values, label=k) + axs[cnt].set_ylabel(f"{tr.config['label']} ({tr.config['unit']})") + axs[cnt].legend() + axs[cnt].grid() cnt+=1 - if cnt == 1: - ax1=plt.subplot(nplots, 1, cnt) - else: - plt.subplot(nplots, 1, cnt, sharex=ax1) - plt.plot(x, tr.values, label=k) - plt.ylabel(f"{tr.config['label']} ({tr.config['unit']})") - plt.legend() - plt.grid() plt.xlabel(f"{self.x.config['label']} ({self.x.config['unit']})") def items(self): |