From fa82907bceedd288547f2be9340303323e8764de Mon Sep 17 00:00:00 2001
From: Gamelin Alexis <alexis.gamelin@synchrotron-soleil.fr>
Date: Fri, 30 Jul 2021 16:49:57 +0200
Subject: [PATCH] Fix plot_bunchdata when multiples files are used

---
 tracking/monitors/plotting.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tracking/monitors/plotting.py b/tracking/monitors/plotting.py
index a2c2f3b..569dee0 100644
--- a/tracking/monitors/plotting.py
+++ b/tracking/monitors/plotting.py
@@ -302,8 +302,9 @@ def plot_bunchdata(filenames, bunch_number, dataset, dimension="x",
 
         x_axis = file[group]["time"][:]
         xlabel = "Number of turns"
-            
-        fig, ax = plt.subplots()        
+        
+        if i == 0:
+            fig, ax = plt.subplots() 
         ax.plot(x_axis, y_var)
         ax.set_xlabel(xlabel)
         ax.set_ylabel(label)
-- 
GitLab