aboutsummaryrefslogtreecommitdiff
path: root/qolab/data/trace.py
diff options
context:
space:
mode:
Diffstat (limited to 'qolab/data/trace.py')
-rw-r--r--qolab/data/trace.py13
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):