diff --git a/Code/Mantid/MantidPlot/mantidplotpy/matplotlib/__init__.py b/Code/Mantid/MantidPlot/mantidplotpy/matplotlib/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Code/Mantid/MantidPlot/mantidplotpy/matplotlib/pyplot.py b/Code/Mantid/MantidPlot/mantidplotpy/matplotlib/pyplot.py new file mode 100644 index 0000000000000000000000000000000000000000..670540d56ba4306559079b060b8b6d87af5e8539 --- /dev/null +++ b/Code/Mantid/MantidPlot/mantidplotpy/matplotlib/pyplot.py @@ -0,0 +1,40 @@ +import numpy as np +from mantid.api import MatrixWorkspace as MatrixWorkspace + +def __is_array(arg): + return isinstance(arg, list) or isinstance(arg, np.ndarray) + +def __is_workspace(arg): + return isinstance(arg, MatrixWorkspace) + +def __is_array_of_workspaces(arg): + return __is_array(arg) and len(arg) > 0 and __is_workspace(arg[0]) + + +def __plot_as_workspace(arg): + print "TODO plot_as_workspace" + pass + +def __plot_as_workspaces(arg): + print "TODO plot as workspaces" + pass + +def __plot_as_array(arg): + print "TODO plot as array" + pass + + + +def plot (y, x=None, marker=None): + print type(y) + if __is_array(y): + if __is_array_of_workspaces(y): + __plot_as_workspaces(y) + elif __is_workspace(y): + __plot_as_workspace(y) + else: + __plot_as_array(y) + else: + raise ValueError("Cannot plot argument of type " + str(type(y)) ) + +