Plotting Functions#
This page documents all plotting and visualisation functions.
3D Visualisation#
2D Plotting#
Detector Data#
Reciprocal Space#
Phase & Amplitude#
Utilities#
- cdiutils.plot.add_colorbar(ax, mappable=None, loc='right', size='5%', pad=0.05, label_size=6, scientific_notation=False, **kwargs)[source]#
Add a colorbar to the given axes. Stolen from Edoardo Zatterin sxdm package (https://gitlab.esrf.fr/id01-science/id01-sxdm-utils/).
- Parameters:
ax (plt.Axes) – the axes to which the colorbar will be added.
mappable (matplotlib.cm.ScalarMappable, optional) – the mappable object that the colorbar will be based on. If None, will take ax.images[0]. Defaults to None.
loc (str, optional) – the location where the colorbar will be placed. Defaults to “right”.
size (str, optional) – the size of the colorbar. Defaults to “5%”.
pad (float, optional) – the padding between the colorbar and the axes. Defaults to 0.05.
label_size (int, optional) – the size of the colorbar labels. Defaults to 6.
scientific_notation (bool, optional) – whether to use scientific notation for colorbar labels. Defaults to False.
- Returns:
the colorbar object.
- Return type:
matplotlib.colorbar.Colorbar
- cdiutils.plot.get_figure_size(width='default', scale=1, subplots=(1, 1))[source]#
Get the figure dimensions to avoid scaling in LaTex.
This function was taken from https://jwalton.info/Embed-Publication-Matplotlib-Latex/
- Parameters:
width (int | str) – Document width in points, or string of predefined
document type (float or string) :param fraction: fraction of the width which you wish the figure to occupy (float) :param subplots: the number of rows and columns of subplots
- Returns:
dimensions of the figure in inches (tuple)
- Return type:
tuple