\(\renewcommand\AA{\unicode{x212B}}\)

Basic 1D and Tiled Plots



Other Plot Types

General Plot Help



Single 1D Plots



To create a single 1D plot, right-click on a workspace and select Plot > Spectrum.... Check the Plot Type is set to Individual before choosing which spectra to plot and selecting OK.



Plot Toolbar

Plot Toolbar 1D Spectrum


Click Menus

Click Menus 1D


O ptions Menu

Plot Options Axes Legend
TIP: Change a Legend entry by editing Set curve label on the Curves tab. Then on the Legend tab there are Color and Font options.


Plot Options Axes Legend


Scripting

Click the generate a script button GenerateAScript.png on a 1D Plot:

# import mantid algorithms, numpy and matplotlib
import matplotlib.pyplot as plt
from mantid.plots.utility import MantidAxType
from mantid.api import AnalysisDataService as ADS

MAR11060 = ADS.retrieve('MAR11060')

fig, axes = plt.subplots(edgecolor='#ffffff', num='MAR11060-1', subplot_kw={'projection': 'mantid'})
axes.plot(MAR11060, color='#1f77b4', label='MAR11060: spec 1', wkspIndex=0)
axes.plot(MAR11060, color='#ff7f0e', label='MAR11060: spec 2', wkspIndex=1)
axes.plot(MAR11060, color='#2ca02c', label='MAR11060: spec 3', wkspIndex=2)
axes.tick_params(axis='x', which='major', **{'gridOn': False, 'tick1On': True, 'tick2On': False, 'label1On': True, 'label2On': False, 'size': 6, 'tickdir': 'out', 'width': 1})
axes.tick_params(axis='y', which='major', **{'gridOn': False, 'tick1On': True, 'tick2On': False, 'label1On': True, 'label2On': False, 'size': 6, 'tickdir': 'out', 'width': 1})
axes.set_title('MAR11060')
axes.set_xlabel('Time-of-flight ($\\mu s$)')
axes.set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes.legend(fontsize=8.0).set_draggable(True).legend

plt.show()
../_images/ImageNotFound.png

Enable :plots: using DOCS_PLOTDIRECTIVE in CMake

For more advice: Formatting Plots with a script



Tiled Plots



To create a tiled plot, right-click on a workspace and select Plot > Spectrum.... Check the Plot Type is set to Tiled before choosing which spectra to plot and selecting OK.



Plot Toolbar

Plot Toolbar Tiled and Colorfill Plots


Click Menus

Click Menus Tiled Plots


O ptions Menu

Tiled plots are essentially an array of axes (1D plots) on the same figure. As such, when editing them in the Options Menu, you should take care to select the correct set of axes:

Plot Options Tiled Axes

Plot Options Axes Legend Tiled plots
TIP: Change a Legend entry by editing Set curve label on the Curves tab. Then on the Legend tab there are Color and Font options.


Plot Options Curves


Scripting

An example script for a Tiled Plot:

# import mantid algorithms, numpy and matplotlib
from mantid.simpleapi import *
import matplotlib.pyplot as plt
from mantid.plots.utility import MantidAxType
from mantid.api import AnalysisDataService as ADS

MAR11060 = ADS.retrieve('MAR11060') #May replace with Load('MAR11060')

fig, axes = plt.subplots(edgecolor='#ffffff', ncols=2, nrows=2, num='MAR11060-1', subplot_kw={'projection': 'mantid'})
axes[0][0].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 1', wkspIndex=0)
axes[0][0].set_xlabel('Time-of-flight ($\\mu s$)')
axes[0][0].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[0][0].legend(fontsize=8.0).set_draggable(True).legend

axes[0][1].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 2', wkspIndex=1)
axes[0][1].set_xlabel('Time-of-flight ($\\mu s$)')
axes[0][1].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[0][1].legend(fontsize=8.0).set_draggable(True).legend

axes[1][0].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 3', wkspIndex=2)
axes[1][0].set_xlabel('Time-of-flight ($\\mu s$)')
axes[1][0].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[1][0].legend(fontsize=8.0).set_draggable(True).legend

axes[1][1].plot(MAR11060, color='#1f77b4', label='MAR11060: spec 4', wkspIndex=3)
axes[1][1].set_xlabel('Time-of-flight ($\\mu s$)')
axes[1][1].set_ylabel('Counts ($\\mu s$)$^{-1}$')
legend = axes[1][1].legend(fontsize=8.0).set_draggable(True).legend

plt.show()
../_images/ImageNotFound.png

Enable :plots: using DOCS_PLOTDIRECTIVE in CMake

For more advice: Formatting Plots with a script



General

General Plot Help



Plots Toolbox

Plot Toolbox


File > Settings

Plot Settings


Other Plotting Documentation