diff --git a/py4DSTEM/braggvectors/braggvector_methods.py b/py4DSTEM/braggvectors/braggvector_methods.py index 669817788..33de8f8c4 100644 --- a/py4DSTEM/braggvectors/braggvector_methods.py +++ b/py4DSTEM/braggvectors/braggvector_methods.py @@ -647,6 +647,7 @@ def show_origin_fit( vmin=-1 * plot_range, vmax=1 * plot_range, intensity_range="absolute", + show_cbar=True, **kwargs, ) diff --git a/py4DSTEM/visualize/show.py b/py4DSTEM/visualize/show.py index 4e99c0de5..1c316f091 100644 --- a/py4DSTEM/visualize/show.py +++ b/py4DSTEM/visualize/show.py @@ -75,6 +75,7 @@ def show( theta=None, title=None, show_fft=False, + show_cbar=False, **kwargs ): """ @@ -302,7 +303,8 @@ def show( does not add a scalebar. If a dict is passed, it is propagated to the add_scalebar function which will attempt to use it to overlay a scalebar. If True, uses calibraiton or pixelsize/pixelunits for scalebar. If False, no scalebar is added. - show_fft (Bool): if True, plots 2D-fft of array + show_fft (bool): if True, plots 2D-fft of array + show_cbar (bool) : if True, adds cbar **kwargs: any keywords accepted by matplotlib's ax.matshow() Returns: @@ -605,6 +607,8 @@ def show( ax.matshow( mask_display, cmap=cmap, alpha=mask_alpha, vmin=vmin, vmax=vmax ) + if show_cbar: + fig.colorbar(cax, ax=ax) # ...or, plot its histogram else: hist, bin_edges = np.histogram(