A quick guide on how to import and make basic plots with EBSD data in MTEX.
Data import
MTEX allows you to import EBSD from all big vendors of EBSD systems. Prefered data formats are text based data files like .ang
, .ctf
or open binary formats like .osc
or .h5
. Most conveniently, EBSD data may be imported using the import wizard, by typing
import_wizard

or by the command EBSD.load
%load some test data packaged with your MTEX installation
fileName = [mtexDataPath filesep 'EBSD' filesep 'Forsterite.ctf'];
ebsd = EBSD.load(fileName)
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 58485 (24%) notIndexed
1 152345 (62%) Forsterite LightSkyBlue mmm
2 26058 (11%) Enstatite DarkSeaGreen mmm
3 9064 (3.7%) Diopside Goldenrod 12/m1 X||a*, Y||b*, Z||c
Properties: bands, bc, bs, error, mad
Scan unit : um
X x Y x Z : [0 36550] x [0 16750] x [0 0]
Normal vector: (0,0,1)
This command outputs ebsd data stored in a single variable, called ebsd
. This variable contains all relevant information, i.e., the spatial coordinates, the orientation information, a description of the crystal symmetries and all other parameters contained in the input data file.
Phase Plots
In this example, the output above shows that the data set contains three different phases: Forsterite, Enstatite, and Diopside. The spatial distribution of the different phases can be visualized by the plotting command
plotx2east % this command tells MTEX to plot the x coordinates increasing to the east (left)
plot(ebsd,'coordinates','on')

When importing EBSD data it is critically important to align it correctly to a fixed reference frame. This issue is exhaustively discussed in the topic Reference Frame Alignment.
Orientation Plots
Analyzing orientations of an EBSD map can be done only for each phase separately. The key syntax to restrict the data to a single phase is
ebsd('Forsterite')
ans = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
1 152345 (100%) Forsterite LightSkyBlue mmm
Properties: bands, bc, bs, error, mad
Scan unit : um
X x Y x Z : [0 36550] x [0 16750] x [0 0]
Normal vector: (0,0,1)
Now we may restrict the variable to Forsterite orientations by
ebsd('Forsterite').orientations
ans = orientation (Forsterite → xyz)
size: 152345 x 1
and may use this syntax to plot an ipf map of all Forsterite orientations
plot(ebsd('Forsterite'),ebsd('Forsterite').orientations,'micronbar','off')

In this standard form a default color coding of the orientations is chosen. A more complete discussion about how to colorize orientations can be found in the topic IPF Maps.
Grain reconstruction
MTEX contains a sophisticated algorithm for reconstructing the grain structure from EBSD data as described in the paper Grain detection from 2d and 3d EBSD data and the topic Grain Reconstruction. The syntax is
% reconstruct grains with a threshold angle of 10 degrees
grains = calcGrains(ebsd('indexed'),'theshold',10*degree,'minPixel',5)
% smooth the grains to avoid the staircase effect
grains = smooth(grains,5);
grains = grain2d
Phase Grains Pixels Mineral Symmetry Crystal reference frame
1 438 151531 Forsterite mmm
2 207 25670 Enstatite mmm
3 166 7421 Diopside 12/m1 X||a*, Y||b*, Z||c
boundary segments: 35640 (1.6e+06 µm)
inner boundary segments: 285 (13093 µm)
triple points: 1399
Properties: meanRotation, GOS
This creates a variable grains
of type grain2d which contains the full geometric information about all grains and their boundaries. As the simplest application we may just plot the grain boundaries
% plot the grain boundaries on top of the ipf map
hold on
plot(grains.boundary,'lineWidth',2)
hold off

Crystal Shapes
In order to make the visualization of crystal orientations more intuitive MTEX supports crystal shapes. Those are polyhedrons computed to match the typical shape of ideal crystals. In order to overlay the EBSD map with crystal shapes oriented accordingly to the orientations of the grains we proceed as follows.
% define the crystal shape of Forsterite and store it in the variable cS
cS = crystalShape.olivine(ebsd('Forsterite').CS)
% select only Forsterite grains with more then 100 pixels
grains = grains('Forsterite',grains.grainSize > 100);
% plot crystal shapes at the positions of the Forsterite grains
hold on
plot(grains,0.7*cS,'colored')
hold off
cS = crystalShape
mineral: Forsterite (mmm)
vertices: 36
faces: 20

Pole Figures
One of the most important tools for analyzing the orientations in an EBSD map are pole figure plots. Those answer the question of how selected crystal directions, here h
, are aligned with respect to specimen directions
% the selected crystal directions
h = Miller({1,0,0},{0,1,0},{0,0,1},ebsd('Forsterite').CS);
% plot their positions with respect to specimen coordinates
plotPDF(ebsd('Forsterite').orientations,h,'figSize','medium')
I'm plotting 1250 random orientations out of 152345 given orientations
You can specify the the number points by the option "points".
The option "all" ensures that all data are plotted

Inverse Pole Figures
Analogously one can ask for the crystal directions pointing in a selected specimen direction. The resulting plots are called inverse pole figures.
% select the specimen direction
r = vector3d.Z;
% plot the position of the z-Axis in crystal coordinates
plotIPDF(ebsd('Forsterite').orientations,r,'MarkerSize',5,...
'MarkerFaceAlpha',0.05,'MarkerEdgeAlpha',0.05)
I'm plotting 12500 random orientations out of 152345 given orientations
