Generating Figures
- hugheslab.fig_maker.multi_im(imgs, nCols=4, labelLetters=True, labels=None, rowLabels=None, columnLabels=None, fontSize=8, fontFamily='Times New Roman', width=140, dpi=150, autoScale=True)
Produces a multi-panel figure made up of images provided as numpy arrays.
- Arguments:
img : list of ndarray list of images, each image as 2D/3D np array
- Optional Keyword Arguments:
- nColsint
number of columns in figure (default is 4)
- labelLettersboolean
if true, each image gets a letter label (default is True)
- labelslist of str
list of labels to use for images (default None).
- rowLabelslist of str
list of labels for rows (default None)
- columnLabelslist of str
list of labels for columns (default None)
- fontSizefloat
font size for all labels
- fontFamilystr
font family as a string
- widthfloat
width of figure in mm (default 140)
- dpifloat
dpi of figure (defaut 150)
- Returns :
Matplotlib figure
- hugheslab.fig_maker.ax_zoom(ax, loc, zoom=4, place='se', displayLoc=None, offset=0, originBox=True, zoomBox=True, lines=True, mainBox=True, autoScale=True, scaleFactor=1)
Adds a zoom inset to an axis
- Arguments:
ax : reference to axis loc : zoomed area as tuple of (x,y,w,h)
- Keyword Arguments:
zoom : zoom factor place : reserved displayLoc : reserved offset : overhang of inset over edge of original image, either int or tuple of (x,y) originBox : True to draw box around zoom in original image (default) zoomBox : True to draw box around zoom in zoomed image (default) lines : True to draw lines between original and new areas (default) mainBox : True to frame image (default)
- hugheslab.fig_maker.scalebar(ax, length=100, text=None, hoffset=1, voffset=2, w=None, h=1, place='nw', padding=1, shadow=True)
Adds a scalebar to an image
- Arguments:
ax : axis object length : int
length of scalebar in image pixels
- textstr
label to sit next to scale bar
- hoffsetfloat
distance from horizontal edge
- voffsetfloat
distance from vertiacl end
- wfloat
if specified sets widths of bar to this in mm
- hfloat
height of bar in mm
- placestr
compass point location, ‘nw’ or ‘se’
- hugheslab.fig_maker.get_zoom(img, loc, zoom=4)
Gets a zoomed image from part of another image.
- hugheslab.fig_maker.img_zoom(img, loc, zoom=4, place='se', displayLoc=None)
Adds an zoomed inset to an image.
- Arguments:
- imgndarray
the original image, 2D numpy array
- loctuple
location of inset, tuple of (x,y,w,h)
- zoomfloat
zoom factor (default 4)
- placestr
compass location: ‘se’, ‘ne’, ‘nw’ or ‘sw’