the grains of a map as polygons, coloured by phase, by a value or by orientation, with their boundaries on top

Syntax

plot(grains)

Colours by phase.

plot(grains, grains.area, colorbar=True)

Colours by a value per grain.

plot(grains['Forsterite'], grains['Forsterite'].meanOrientation)

By mean orientation.

plot(grains, ipfDirection=xvector)

Every phase by its inverse pole figure key along x.

plot(grains, alpha=0, lineColor='r')

The outlines alone, in red.

plot(grains, boundary=False, translucent=0.5)

No boundary, faded by colour.

plot(grains, faceColor='red', displayName='all grains')

One colour, in the legend.

plot(grains, cS)

The crystal shape of every grain.

plot(grains, v)

An axis per grain as a needle.

Description

Every grain is one polygon with its holes, coloured as mapValues describes: by phase, by a value per grain through a colour map, by orientation through the inverse pole figure key of its phase or an orientation colour key, by an RGB colour per grain, or in one colour. The boundary is drawn on top in lineColor, else in the face colour, else black.

Two kinds of color draw something else at every grain:

  • a crystalShape: the shape rotated by the mean orientation of the grain, at its centroid.
  • a vector3d per grain: the axis as a needle through the centroid, the half pointing out of the screen black, the other white.

translucent=s fades a grain by its colour, as MATLAB’s ‘translucent’: the opacity is s (1 - min(r, g, b)) for a colour and s v / max(v) for a value, so that pale grains let what lies below show.

region=(xmin, xmax, ymin, ymax) shows a part of the map, title= names the axes, coordinates=True labels them, how2plot= sets another plottingConvention, parent= the axes and figSize= the size of a new figure. Other keywords go to the matplotlib artist.

Input

grains grain2d
color the colouring: an array of values or of RGB colours, orientations, an orientationColorKey, a crystalShape, a vector3d per grain, the name of a property or of a measure (‘area’, ‘aspectRatio’, …), ‘phase’ or one colour

Keywords

keyword default description
faceColor None one colour for every grain; ‘none’ draws the outlines alone
colormap 'viridis' the colour map of values
colorRange None (lo, hi), the values the colour map spans
colorbar False add a colour bar for values
micronbar None draw the scale bar; by default the preference showMicronBar
refFrame True draw the axes of the specimen frame in the scale bar box
location None the corner of the scale bar, ‘sw’, ‘se’, ‘nw’ or ‘ne’
ipfDirection None vector3d, colour by orientation through the inverse pole figure key along this specimen direction
boundary True draw the grain boundary on top, MATLAB’s flag noBoundary as boundary=False
lineWidth 1.0 the width of the boundary
lineColor None the colour of the boundary
alpha 1.0 the opacity of the grains
legend None draw the legend of the phases or the inverse pole figure keys; by default for a phase map
displayName None the name in a legend
translucent None s, the opacity of a grain following its colour, as above

Output

h the matplotlib collection of the grains

See also

GrainSpatialPlots, EBSD.plot, grainBoundary.plot, mapValues, crystalShape

MATLAB’s grain2d.plot

source

Citing this page. This page is part of the documentation of MTEX, a free and open source MATLAB toolbox for analyzing and modeling crystallographic textures. It was written by The MTEX Developers and is published at https://mtex-toolbox.github.io/grain2d.plot_py.html. If you use MTEX, or reuse text or figures from this page, in your research, please cite

F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63

BibTeX
@article{bachmann2010mtex,
  author  = {F. Bachmann and R. Hielscher and H. Schaeben},
  title   = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
  journal = {Solid State Phenomena},
  volume  = {160},
  pages   = {63-68},
  year    = {2010},
  doi     = {10.4028/www.scientific.net/SSP.160.63},
  url     = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}

Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.