From 1b8adadd95d2eeb4a4e234b843fc46b8c624f002 Mon Sep 17 00:00:00 2001
From: AlQuemist <alquemist@Lyriks>
Date: Mon, 22 Jul 2024 16:01:49 +0200
Subject: [PATCH] ba_plot: add a function to export the plot

---
 Wrap/Python/src/bornagain/ba_plot.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Wrap/Python/src/bornagain/ba_plot.py b/Wrap/Python/src/bornagain/ba_plot.py
index 83872810caf..33c8a92f0cc 100644
--- a/Wrap/Python/src/bornagain/ba_plot.py
+++ b/Wrap/Python/src/bornagain/ba_plot.py
@@ -466,6 +466,12 @@ def show_or_export(**plotargs):
         plt.show()
 
 
+def export(**plotargs):
+    _figfile = plotargs.pop('figfile', None)
+    if _figfile:
+        plt.savefig(_figfile, format=plotargs['saveformat'], bbox_inches='tight')
+
+
 def plot_simulation_result(result, **plotargs):
     """
     Draws simulation result and (optionally) shows the plot.
-- 
GitLab