Open Matlab File in the Editor MTEX

Color Coding

A central issue when interpreting plots is to have a consistent color coding among all plots. In MTEX this can be achieved in two ways. If the the minimum and maximum value are known then one can specify the color range directly using the options colorrange or contourf, or the command setcolorrange is used which allows to set the color range afterwards.

On this page ...
A sample ODFs and Simulated Pole Figure Data
Tight Colorcoding
Equal Colorcoding
Setting an Explicite Colorrange
Setting the Contour Levels
Modifying the Colorrange After Plotting
Logarithmic Plots
Changing the Colormap

A sample ODFs and Simulated Pole Figure Data

Let us first define some model ODFs to be plotted later on.

cs = crystalSymmetry('-3m');
odf = fibreODF(Miller(1,1,0,cs),zvector)
pf = calcPoleFigure(odf,[Miller(1,0,0,cs),Miller(1,1,1,cs)],...
  equispacedS2Grid('points',500,'antipodal'));
 
odf = ODF  
  crystal symmetry : -3m1, X||a*, Y||b, Z||c*
  specimen symmetry: 1
 
  Fibre symmetric portion:
    kernel: de la Vallee Poussin, halfwidth 10°
    fibre: (11-20) - 0,0,1
    weight: 1
 

Tight Colorcoding

When plot is called without any colorcoding option, the plots are constructed using the tight option to the range of the data independently from the other plots. This means that different pole figures may have different color coding and in principle cannot be compared to each other.

close all
plot(pf)
colorbar

Equal Colorcoding

The tight colorcoding can make the reading and comparison of two pole figures a bit hard. If you want to have one colorcoding for all plots within one figure use the option colorrange to equal.

plot(pf,'colorRange','equal')
colorbar

Setting an Explicite Colorrange

If you want to have a unified colorcoding for several figures you can set the colorrange directly in the plot command

close all
plotPDF(odf,[Miller(1,0,0,cs),Miller(1,1,1,cs)],...
  'colorrange',[0 4],'antipodal');
colorbar

figure
plotPDF(.5*odf+.5*uniformODF(cs),[Miller(1,0,0,cs),Miller(1,1,1,cs)],...
  'colorrange',[0 4],'antipodal');
colorbar

Setting the Contour Levels

In the case of contour plots you can also specify the contour levels directly

close all
plotPDF(odf,[Miller(1,0,0,cs),Miller(1,1,1,cs)],...
  'contourf',0:1:5,'antipodal')
colorbar

Modifying the Colorrange After Plotting

The color range of the figures can also be adjusted afterwards using the command CLim

CLim(gcm,[0.38,3.9])

Logarithmic Plots

Sometimes logarithmic scaled plots are of interest. For this case all plots in MTEX understand the option logarithmic, e.g.

close all;
plotPDF(odf,[Miller(1,0,0,cs),Miller(1,1,1,cs)],'antipodal','logarithmic')
CLim(gcm,[0.01 12]);
colorbar

Changing the Colormap

The colormap can be changed by the command mtexColorMap, e.g., in order to set a white to black colormap one has the commands

plotPDF(odf,[Miller(1,0,0,cs),Miller(1,1,1,cs)],'antipodal')
mtexColorMap white2black
colorbar