CrystalMapPlot.plot_map(crystal_map: orix.crystal_map.CrystalMap, value: Optional[ndarray] = None, scalebar: bool = True, scalebar_properties: Optional[dict] = None, legend: bool = True, legend_properties: Optional[dict] = None, override_status_bar: bool = False, **kwargs) AxesImage[source]#

Plot a 2D map with any CrystalMap attribute as map values.

Wraps matplotlib.axes.Axes.imshow(), see that method for relevant keyword arguments.


Crystal map object to obtain data to plot from.


Attribute array to plot. If value is None (default), a phase map is plotted.


Whether to add a scalebar (default is True) along the horizontal map dimension.


Dictionary of keyword arguments passed to mpl_toolkits.axes_grid1.anchored_artists.AnchoredSizeBar.


Whether to add a legend to the plot. This is only implemented for a phase plot (in which case default is True).


Dictionary of keyword arguments passed to matplotlib.axes.Axes.legend().


Whether to display Euler angles and any overlay values in the status bar when hovering over the map (default is False).


Keyword arguments passed to matplotlib.axes.Axes.imshow().


Image object, to be used further to get data from etc.


>>> from orix import data, plot
>>> from import load

Import a crystal map

>>> xmap = data.sdss_ferrite_austenite()

Plot a phase map

>>> fig, ax = plt.subplots(subplot_kw=dict(projection="plot_map"))
>>> _ = ax.plot_map(xmap)

Add an overlay

>>> ax.add_overlay(xmap,

Plot an arbitrary map property, also changing scalebar location

>>> _ = plt.figure()
>>> ax = plt.subplot(projection="plot_map")
>>> _ = ax.plot_map(xmap, xmap.dp, scalebar_properties={"location": 4})

Add a colorbar

>>> cbar = ax.add_colorbar("Dot product")  # Get colorbar

Plot orientation angle in degrees of one phase

>>> xmap2 = xmap["austenite"]
>>> austenite_angles = xmap2.orientations.angle * 180 / np.pi
>>> fig = plt.figure()
>>> ax = fig.add_subplot(projection="plot_map")
>>> im = ax.plot_map(xmap2, austenite_angles)
>>> _ = ax.add_colorbar("Orientation angle [deg]")

Remove all figure and axes padding

>>> _ = ax.remove_padding()

Write annotated figure to file

>>> #fig.savefig("image.png", pad_inches=0, bbox_inches="tight")

Write un-annotated image to file

>>> #plt.imsave("image2.png", im.get_array())

Examples using CrystalMapPlot.plot_map#