Skip to content
Snippets Groups Projects
Commit 3bbd31d2 authored by Peterson, Peter's avatar Peterson, Peter
Browse files

Try both arg lists for Layout

parent 4c2c750d
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment