Ticket #9252: test_plot_axes.py

File test_plot_axes.py, 1.5 KB (added by Martyn Gigg, 6 years ago)
Line 
1def do_plot_1d(data, vertical, title):
2        if vertical:
3                g = plotBin(data, 0)
4        else:
5                g = plotSpectrum(data, 0)
6        g.activeLayer().setTitle(title)
7# end def
8
9raw = Load(Filename="MAR11001.raw")
10
11do_plot_1d(raw, vertical=False, title="spectrum axis on Y, numeric on X")
12do_plot_1d(raw, vertical=True, title="numeric axis on Y, spectrum on X")
13
14theta = ConvertSpectrumAxis(raw,Target="Theta")
15do_plot_1d(theta, vertical=False, title="numeric axis on Y, numeric on X.")
16do_plot_1d(theta, vertical=True, title="numeric axis on Y, numeric on X. ")
17
18#
19distr = CloneWorkspace(raw)
20ConvertToDistribution(distr)
21do_plot_1d(distr, vertical=False, title="spectrum axis on Y. numeric on X. WS is distribution")
22do_plot_1d(distr, vertical=True, title="numeric axis on Y. spectrum X. WS is distribution")
23
24#
25theta_distr = CloneWorkspace(theta)
26ConvertToDistribution(theta_distr)
27do_plot_1d(theta_distr, vertical=False, title="numeric axis on Y. numeric on X. WS is distribution")
28do_plot_1d(theta_distr, vertical=True, title="numeric axis on Y. numeric X. WS is distribution")
29
30##################################################################
31# 2D
32def do_plot_2d(data, title):
33        mm = importMatrixWorkspace(str(data))
34        g = mm.plotGraph2D()
35        g.activeLayer().setTitle(title)
36# end def
37
38#
39do_plot_2d(raw, "spectrum axis on Y, numeric on X")
40#
41do_plot_2d(theta, "numeric axis on Y, numeric on X")
42#
43do_plot_2d(distr, "spectrum axis on Y, numeric on X. WS is distribution")
44
45#
46do_plot_2d(theta_distr, "numeric axis on Y, numeric on X. WS is distribution")
47