From 3bbd31d216a1f7f2035c4d3ea4be7daf566fe023 Mon Sep 17 00:00:00 2001
From: Pete Peterson <petersonpf@ornl.gov>
Date: Fri, 18 Jan 2019 12:16:26 -0500
Subject: [PATCH] Try both arg lists for Layout

---
 .../algorithms/WorkflowAlgorithms/SavePlot1D.py   | 15 +++++++++++----
 .../WorkflowAlgorithms/SavePlot1DTest.py          |  2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SavePlot1D.py b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SavePlot1D.py
index 293f99c66b0..146814c99ea 100644
--- a/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SavePlot1D.py
+++ b/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SavePlot1D.py
@@ -164,9 +164,16 @@ class SavePlot1D(mantid.api.PythonAlgorithm):
             (traces, xlabel, ylabel) = self.toScatterAndLabels(self._wksp,
                                                                spectraNames)
 
-            layout = go.Layout(yaxis={'title': {'text':ylabel}},
-                               xaxis={'title': {'text':xlabel}},
-                               margin={'l':40,'r':0,'t':0,'b':40})
+            # plotly seems to change the way to set the axes labels
+            # randomly and within a version. Just give up and try both.
+            try:
+                layout = go.Layout(yaxis={'title': ylabel},
+                                   xaxis={'title': xlabel},
+                                   margin={'l': 40, 'r': 0, 't': 0, 'b': 40})
+            except RuntimeError:
+                layout = go.Layout(yaxis={'title': {'text': ylabel}},
+                                   xaxis={'title': {'text': xlabel}},
+                                   margin={'l': 40, 'r': 0, 't': 0, 'b': 40})
 
             fig = go.Figure(data=traces, layout=layout)
 
@@ -201,7 +208,7 @@ class SavePlot1D(mantid.api.PythonAlgorithm):
 
             data.append(go.Scatter(x=x, y=y, name=label, visible=visible))
 
-        (xlabel, ylabel) = self.getAxesLabels(wksp, utf8=False)
+        (xlabel, ylabel) = self.getAxesLabels(wksp, utf8=True)
 
         return (data, xlabel, ylabel)
 
diff --git a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SavePlot1DTest.py b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SavePlot1DTest.py
index 5d9a165ec2a..96b8cb6ea0e 100644
--- a/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SavePlot1DTest.py
+++ b/Framework/PythonInterface/test/python/plugins/algorithms/WorkflowAlgorithms/SavePlot1DTest.py
@@ -30,7 +30,7 @@ except:
 class SavePlot1DTest(unittest.TestCase):
     def makeWs(self):
         simpleapi.CreateWorkspace(OutputWorkspace='test1', DataX='1,2,3,4,5,1,2,3,4,5', DataY='1,2,3,4,2,3,4,5',
-                                  DataE='1,2,3,4,2,3,4,5', NSpec='2', UnitX='TOF', Distribution='1', YUnitlabel="S(q)")
+                                  DataE='1,2,3,4,2,3,4,5', NSpec='2', UnitX='dSpacing', Distribution='1', YUnitlabel="S(q)")
         simpleapi.CreateWorkspace(OutputWorkspace='test2', DataX='1,2,3,4,5,1,2,3,4,5', DataY='1,2,3,4,2,3,4,5',
                                   DataE='1,2,3,4,2,3,4,5', NSpec='2',
                                   UnitX='Momentum', VerticalAxisUnit='TOF', VerticalAxisValues='1,2', Distribution='1',
-- 
GitLab