Skip to content

Commit

Permalink
Fix plotBin command. Refs #5181
Browse files Browse the repository at this point in the history
Also added a test for it.
  • Loading branch information
martyngigg committed May 1, 2012
1 parent 32dd655 commit 45a68b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Code/Mantid/MantidPlot/mantidplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,9 +726,9 @@ def __doBinPlot(source, indices, error_bars,type):

def __plotBinSingle(workspace, indices, error_bars,type):
if isinstance(indices, list) or isinstance(indices, tuple):
master_graph = __CallPlotFunction(workspace, indices[0], error_bars,type)
master_graph = __callPlotBin(workspace, indices[0], error_bars,type)
for index in indices[1:]:
mergePlots(master_graph, __CallPlotFunction(workspace, index, error_bars,type))
mergePlots(master_graph, __callPlotBin(workspace, index, error_bars,type))
return master_graph
else:
return __callPlotBin(workspace, indices, error_bars,type)
Expand All @@ -746,13 +746,13 @@ def __plotBinList(workspace_list, indices, error_bars,type):
else:
master_graph = __callPlotBin(workspace_list[0], indices, error_bars,type)
for workspace in workspace_list[1:]:
mergePlots(master_graph, __CallPlotFunction(workspace, indices, error_bars,type))
mergePlots(master_graph, __callPlotBin(workspace, indices, error_bars,type))
return master_graph

def __callPlotBin(workspace, index, error_bars,type):
if isinstance(workspace, str):
wkspname = workspace
else:
wkspname = workspace.getName()
return proxies.Graph(threadsafe_call('plotBin',wkspname, index, error_bars,type))
return proxies.Graph(threadsafe_call(_qti.app.mantidUI.plotBin,wkspname, index, error_bars,type))
#------------------------------------------------------------------------------------------
10 changes: 10 additions & 0 deletions Code/Mantid/MantidPlot/test/MantidPlot1DPlotTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ def test_standard_plot_command(self):

l.setCurveLineStyle(1, QtCore.Qt.DotLine)
l.setCurveLineStyle(2, QtCore.Qt.DashLine)

def test_plotBin_command_with_single_index(self):
g = plotBin("fake", 0)
self.assertTrue(g is not None)
self.g = g

def test_plotBin_command_with_list(self):
g = plotBin("fake", [0,1])
self.assertTrue(g is not None)
self.g = g

# Run the unit tests
mantidplottests.runTests(MantidPlot1DPlotTest)
Expand Down

0 comments on commit 45a68b7

Please sign in to comment.