Advanced Color Keys edit page

In order to visualize orientation maps one has to assign a color to each possible orientation. As an example, one may think of representing an orientation by its Euler angles ph1, Phi, phi2 and taking these as the RGB values of a color. Of course, there are many other ways to do this. Before presenting all the possibilities MTEX offers to assign a color to each orientation let us shortly summarize what properties we expect from such an assignment.

  1. crystallographic equivalent orientations should have the same color
  2. similar orientations should have similar colors
  3. different orientations should have different colors
  4. the whole colorspace should be used for full contrast
  5. if the orientations are concentrated in a small region of the orientation space, the colorspace should be exhaust by this region

It should be noted that it is impossible to have all the 4 points mentioned above be satisfied by a single color coding. Hence, some compromises have to be accepted and some assumptions have to be made. While the traditional Euler angle coloring will assign different colors to similar orientations, i.e. will introduce color jumps and break with the first requirement the default MTEX color key will assign the same color to different orientations.

Hence, there is no perfect color key, but it should be chosen depending on the information one want to extract from the orientation data. To do so MTEX offers the following possibilities:

In order to demonstrate these color keys we first import some toy data set.

close all; plotx2east
mtexdata forsterite
csFo = ebsd('Forsterite').CS;
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, x, y
 Scan unit : um

Euler Angle Coloring

The oldest way to colorize orientations is to simply map the three Euler angles into the RGB values. This can be done by

colorKey = BungeColorKey(csFo);


Although this visualization looks very smooth, the orientation map using Euler angles introduces many of color jumps. This becomes obvious when plotting the colors as sigma sections, i.e., for fixed differences \(\phi_1 - \phi_2\)


Coloring certain orientations

We might be interested in locating some special orientation in our orientation map. The definition of colors for certain orientations is carried out similarly as in the case of fibers

colorKey = spotColorKey(ebsd('Fo')); = mean(ebsd('Forsterite').orientations,'robust');
colorKey.color = [0,0,1];
colorKey.psi = SO3DeLaValleePoussinKernel('halfwidth',20*degree);


% and the corresponding color-map

the area of the colored EBSD data in the map corresponds to the volume portion (in percent)

vol = 100 * volume(ebsd('fo').orientations,,20*degree)
vol =

actually, the colored measurements stress a peak in the ODF

close all
odf = calcDensity(ebsd('fo').orientations,'halfwidth',10*degree,'silent');

Coloring fibers

To color a fibre, one has to specify the crystal direction h together with its RGB color and the specimen direction r, which should be marked.

% define a fibre
f = fibre(Miller(1,1,1,csFo),zvector);

% set up coloring
colorKey = ipfSpotKey(csFo);
colorKey.inversePoleFigureDirection = f.r; = f.h;
colorKey.color = [0 0 1];
colorKey.psi = S2DeLaValleePoussinKernel('halfwidth',7.5*degree);


the option 'halfwidth' controls half of the intensity of the color at a given distance. Here we have chosen the (111)[001] fibre to be drawn in blue, and at 7.5 degrees, where the blue should be only lighter.

hold on

the percentage of blue colored area in the map is equivalent to the fibre volume

vol = volume(ebsd('fo').orientations,f,15*degree)

hold off
vol =
  I'm plotting 200 random orientations out of 152345 given orientations

we can easily extend the color-coding

% the centers in the inverse pole figure = Miller({0 0 1},{0 1 1},{1 1 1},{11 4 4},{5 0 2},{5 5 2},csFo);

% the corresponding colors
colorKey.color = [[1 0 0];[0 1 0];[0 0 1];[1 0 1];[1 1 0];[0 1 1]];

% plot the key
hold on
hold off
I'm plotting 1000 random orientations out of 152345 given orientations
close all;

Combining different plots

Combining different plots can be done either by plotting only subsets of the EBSD data or via the option 'faceAlpha'. Note that the option 'faceAlpha' requires the renderer of the figure to be set to 'opengl'.

close all;
mtexColorMap black2white

colorKey = ipfSpotKey(csFo);
colorKey.inversePoleFigureDirection = zvector; = Miller(1,1,1,csFo);
colorKey.color = [0 0 1];
colorKey.psi = S2DeLaValleePoussinKernel('halfwidth',7.5*degree);

hold on
hold off

%   <div class="note">
%      <b>ok&lt;*NASGU&gt;
%      <text/>
%   </div>