Module iaf.plot
Plotting functions.
Sub-modules
iaf.plot.utils- 
Utility plotting functions.
 iaf.plot.validation- 
Validation plotting functions.
 
Functions
def add_fit(fig: matplotlib.figure.Figure, ax: matplotlib.axes._axes.Axes, x: Union[numpy.ndarray, list], y_hat: Union[numpy.ndarray, list], a: Optional[None] = None, b: Optional[None] = None, sse: Optional[None] = None, model_for_legend: str = 'linear', legend_location: str = 'best', dpi: int = 150, out_file_name: Union[ForwardRef(None), pathlib.Path, str] = None) ‑> tuple- 
Add another fit to an existing plot_data() figure.
Parameters
fig:Figure- A matplotlib figure.
 ax:Union[np.ndarray, list]- A matplotlib figure axis.
 x:Union[np.ndarray, list]- List or array of independent values 
x. y_hat:Union[np.ndarray, list] (Optional)- List or array of predicted values 
y_hat. a:Union[None, float] (Optional)- Value of the slope of the predicted line (to be shown in the legend).
 b:Union[None, float] (Optional)- Value of the intercept of the predicted line (to be shown in the legend).
 sse:Union[None, float] (Optional)- Value of the sum of squared difference between 
yandy_hat(to be shown in the legend). model_for_legend:str (Optional)- Set the type of the model to be displayed (based on parameters 
aandb) in the legend. One of"linear", "exp", "log", "sqrt"; default is "linear". legend_location:str (Optional)- Location of the legend. By default, it is 'best'. See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html
 dpi:int (Optional)- Resolution of the figure (please notice, this is set whether the figure is saved or not).
 out_file_name:Union[None, Path, str] (Optional)- Full file name to save the figure. The figure is only displayed if no file name is passed.
 
Returns
handles:tuple- Tuple with current figure and axes.
 
 def imshow(img: numpy.ndarray, *, cmap: Union[ForwardRef(None), str, matplotlib.colors.ListedColormap] = None, auto_stretch: bool = False, clip_percentile: float = 0.0, ax: matplotlib.axes._axes.Axes = None, title: Optional[str] = None, title_font_size: Optional[int] = 10) ‑> None- 
Wrapper around matplotlib.pyplot.imshow that allows for toggling intensity stretching, hides axes, maximizes the canvas.
Parameters
img:np.ndarray- 2D image to be displayed. The image can be gray-value (2D array) or RGB. If RGB, it must be in YXC or YXCA format.
 cmap:None|str|ListedColormap- Color map to be used (optional). Only applies to gray-value images and is ignored for RGB images.
 auto_stretch:bool- Whether to auto-stretch intensities for visualisation (optional, default = False).
Please notice that this only applies to images of type 
np.uint8ornp.uint16:floatimages will always be stretched. clip_percentile:float (Optional, default= 0.0)- Percentile to clip intensity in the low and high parts of the dynamic range.
Ignored if 
auto_stretchisFalse. As forauto_stretch, this only applies to images of typenp.uint8andnp.uint16. ax:matplotlib.axes.Axes (Optional, default= None)- Axis handle. Pass a valid axes handle to display the image there; if omitted, a new figure and a new set of axes will be created.
 title:str- Title for current axes (optional).
 title_font_size:int- Font size for the title of current axes (optional).
 
 def plot_data(x: Union[numpy.ndarray, list], y: Union[numpy.ndarray, list], data_name: str = 'y', x2: Union[ForwardRef(None), numpy.ndarray, list] = None, y_hat: Union[ForwardRef(None), numpy.ndarray, list] = None, a: Optional[None] = None, b: Optional[None] = None, sse: Optional[None] = None, model_for_legend: str = 'linear', errors: Union[ForwardRef(None), numpy.ndarray, list] = None, errors_label: Optional[str] = None, legend_location: str = 'best', label_x: str = 'x', label_y: str = 'y', lim_x: Optional[None] = None, lim_y: Optional[None] = None, marker_size: int = 100, alpha: float = 0.75, split_series: bool = True, figure_size: tuple = (12, 8), dpi: int = 150, out_file_name: Union[ForwardRef(None), pathlib.Path, str] = None) ‑> tuple- 
Flexible plotting function for raw data (single or multiple series), fitted model (optional) and error bars (optional).
Parameters
x:Union[np.ndarray, list]- List or array of independent values 
x. y:Union[np.ndarray, list]- List or array of dependent/target values 
y. data_name:str (Optional, default= "Data")- Name of the data set to be displayed in the legend.
 x2:Union[None, np.ndarray, list] (Optional)- List or array of independent values 
x; it is used to plot the predicted valuey_hat. Omit ifx2is the same asx(in the casexis(m x n),x2will bex[0, :]). If specified, it must be a(1 x n)array. y_hat:Union[np.ndarray, list] (Optional)- List or array of predicted values 
y_hat. If specified, it must be a(1 x n)array. a:Union[None, float] (Optional)- Value of the slope of the predicted line (to be shown in the legend).
 b:Union[None, float] (Optional)- Value of the intercept of the predicted line (to be shown in the legend).
 sse:Union[None, float] (Optional)- Value of the sum of squared difference between 
yandy_hat(to be shown in the legend). alpha:float (Optional)- Transparency (between 0.0 and 1.0) for the dots in the scatter plot.
 split_series:bool (Optional)- Set to 
True(default) to display different series as separate scatter plots with own color, or toFalseto have them all in one plot (and one color). model_for_legend:str (Optional)
Set the type of the model to be displayed (based on parameters
aandb) in the legend. One of"linear", "exp", "log", "sqrt"; default is "linear".errors:Union[None, np.ndarray, list] (Optional)- Errors to be plotted on the data. If specified, it must be a 
(1 x n)array. errors_label:Union[None, str] = None- Name of the errors for the legend.
 legend_location:str (Optional)- Location of the legend. By default, it is 'best'. See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.legend.html
 label_x:str (Optional)- Label of the x-axis (by default it is set to "x").
 label_y:str (Optional)- Label of the y-axis (by default it is set to "y").
 lim_x:Union[None, tuple] (Optional)- By default the extent of the data vector 
xdefines the x-axis limit range. Explicitly set to a tuple(x_min, x_max)to override the x-axis limits. Either one ofx_minorx_maxcan be None if current value should not be changed. In detail: If lim_x is None: The x-axis range will be defined by the limits of the data vectorx. If lim_x is (None, None): The x-axis range will be defined by the limits of everything plotted. If lim_x is (0, None): The x-axis range will be 0 to the higher limit of everything plotted. If lim_x is (None, 100): The x-axis range will from the lower limit of everything plotted to 100. If lim_x is (0, 100): The x-axis range will go from 0 to 100. lim_y:Union[None, tuple] (Optional)- By default the extent of the data vector/array 
ydefines the y-axis limit range. Explicitly set to a tuple(y_min, y_max)to override the y-axis limits. Either one of y_min or y_max can be None if current value should not be changed. In detail: If lim_y is None: The y-axis range will be defined by the limits of the data vector/arrayy. If lim_y is (None, None): The y-axis range will be defined by the limits of everything plotted. If lim_y is (0, None): The y-axis range will be 0 to the higher limit of everything plotted. If lim_y is (None, 100): The y-axis range will from the lower limit of everything plotted to 100. If lim_y is (0, 100): The y-axis range will go from 0 to 100. marker_size:int (Optional)- Size of the marker. By default, it is set to 100.
 split_series:bool (Optional)- Set to 
True(default) to display different series as separate scatter plots with own color, or toFalseto have them all in one plot (and one color). figure_size:tuple (Optional)- Size of the figure.
 dpi:int (Optional)- Resolution of the figure (please notice, this is set whether the figure is saved or not).
 out_file_name:Union[None, Path, str] (Optional)- Full file name to save the figure. The figure is only displayed if no file name is passed.
 
Returns
handles:tuple- Tuple with current figure and axes.
 
 def show_labels(labels: numpy.ndarray, cmap=None, plot_centroids: bool = False, plot_labels: bool = False, ax: matplotlib.axes._axes.Axes = None, title: Optional[str] = None, title_font_size: Optional[None] = 10.0, label_font_size: Union[float, str, ForwardRef(None)] = 10.0) ‑> None- 
Plots a labels image with a suited color map by default.
Parameters
labels:np.ndarray- 2D label image to be displayed. The image must be a label image.
 cmap:None|ListedColormap- Color map to be used (optional). If omitted, a suitable one will be used.
 plot_centroids:bool- Set to True to plot the centroids of the labels. Only one of 
plot_centroidsandplot_labelscan beTrue. plot_labels:bool- Set to True to plot the label number on the object. Only one of 
plot_centroidsandplot_labelscan beTrue. ax:matplotlib.axes.Axes (Optional, default= None)- Axis handle. Pass a valid axes handle to display the image there; if omitted, a new figure and a new set of axes will be created.
 title:str- Title for current axes (optional).
 title_font_size:float- Font size for the title of current axes (optional).
 label_font_size:float|str- Font size for the labels. It can be either a number or one of {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}