Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions py4DSTEM/visualize/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def show(
and

>>> show(dp, calibration=calibration, scalebar={'length':0.5,'width':2,
'position':'ul','label':True'})
'position':'ul','label':True})

will display a more customized scalebar.

Expand Down Expand Up @@ -316,7 +316,7 @@ def show(
if returnfig==False (default), the figure is plotted and nothing is returned.
if returnfig==True, return the figure and the axis.
"""
if scalebar is True:
if scalebar is True or scalebar is None:
scalebar = {}

# Alias dep
Expand Down Expand Up @@ -428,25 +428,31 @@ def show(
er = ".calibration attribute must be a Calibration instance"
assert isinstance(cal, Calibration), er
if isinstance(ar, DiffractionSlice):
scalebar = {
defaultscalebar = {
"Nx": ar.data.shape[0],
"Ny": ar.data.shape[1],
"pixelsize": cal.get_Q_pixel_size(),
"pixelunits": cal.get_Q_pixel_units(),
"space": "Q",
"position": "br",
}
for key, value in defaultscalebar.items():
if key not in scalebar.keys():
scalebar[key] = value
pixelsize = cal.get_Q_pixel_size()
pixelunits = cal.get_Q_pixel_units()
elif isinstance(ar, RealSlice):
scalebar = {
defaultscalebar = {
"Nx": ar.data.shape[0],
"Ny": ar.data.shape[1],
"pixelsize": cal.get_R_pixel_size(),
"pixelunits": cal.get_R_pixel_units(),
"space": "Q",
"position": "br",
}
for key, value in defaultscalebar.items():
if key not in scalebar.keys():
scalebar[key] = value
pixelsize = cal.get_R_pixel_size()
pixelunits = cal.get_R_pixel_units()
# get the data
Expand Down
2 changes: 1 addition & 1 deletion py4DSTEM/visualize/vis_special.py
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ def show_complex(
add_scalebar(ax[0, 0], scalebar)
else:
figsize = kwargs.pop("axsize", None)
figsize = kwargs.pop("figsize", figsize)
figsize = kwargs.pop("figsize", (5, 5))

fig, ax = show(
rgb,
Expand Down