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

Basic 1D and Tiled Plots



Other Plot Types

General Plot Help



Single 1D Plots



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
from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np

from mantid.api import AnalysisDataService as ADS

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

fig, axes = plt.subplots(edgecolor='#ffffff', num='MAR11060-1', subplot_kw={'projection': 'mantid'})
axes.plot(MAR11060, color='#1f77b4', label='MAR11060: spec 1', specNum=1)
axes.plot(MAR11060, color='#ff7f0e', label='MAR11060: spec 2', specNum=2)
axes.plot(MAR11060, color='#2ca02c', label='MAR11060: spec 3', specNum=3)
axes.set_title('MAR11060')
axes.set_xlabel('Time-of-flight ($\mu s$)')
axes.set_ylabel('Counts ($\mu s$)$^{-1}$')
axes.legend().draggable()

plt.show()

(Source code, png, hires.png, pdf)

../_images/1DPlotsHelp-1.png

For more advice: Formatting Plots with a script



Tiled Plots



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
import numpy as np

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', specNum=1)
axes[0][0].set_xlabel('Time-of-flight ($\mu s$)')
axes[0][0].set_ylabel('Counts ($\mu s$)$^{-1}$')
axes[0][0].legend().draggable()

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

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

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

plt.show()

(Source code, png, hires.png, pdf)

../_images/1DPlotsHelp-2.png

For more advice: Formatting Plots with a script



General

General Plot Help



Plots Toolbox

Plot Toolbox


File > Settings

Plot Settings


Other Plotting Documentation