nireports.reportlets.nuisance module¶
Plotting distributions.
- nireports.reportlets.nuisance.confoundplot(tseries, gs_ts, gs_dist=None, name=None, units=None, tr=None, hide_x=True, color='b', nskip=0, cutoff=None, ylims=None)[source]¶
- nireports.reportlets.nuisance.confounds_correlation_plot(confounds_file, columns=None, figure=None, max_dim=20, output_file=None, reference='global_signal', ignore_initial_volumes=0)[source]¶
Generate a bar plot with the correlation of confounds.
- Parameters:
confounds_file (
str) – File containing all confound regressors to be included in the correlation plot.figure (figure or None) – Existing figure on which to plot.
columns (
listorNone.) – Select a list of columns from the dataset.max_dim (
int) – The maximum number of regressors to be included in the output plot. Reductions (e.g., CompCor) of high-dimensional data can yield so many regressors that the correlation structure becomes obfuscated. This criterion selects themax_dimregressors that have the largest correlation magnitude withreferencefor inclusion in the plot.output_file (
strorNone) – Path where the output figure should be saved. If this is not defined, then the plotting axes will be returned instead of the saved figure path.reference (
str) –confounds_correlation_plotprepares a bar plot of the correlations of each confound regressor with a reference column. By default, this is the global signal (so that collinearities with the global signal can readily be assessed).ignore_initial_volumes (
int) – Number of non-steady-state volumes at the beginning of the scan to ignore.
- Returns:
axes and gridspec – Plotting axes and gridspec. Returned only if
output_fileisNone.output_file (
str) – The file where the figure is saved.
- nireports.reportlets.nuisance.plot_carpet(data, segments=None, cmap=None, tr=None, detrend=True, subplot=None, title=None, output_file=None, size=(900, 1200), sort_rows='ward', drop_trs=0, legend=True, fontsize=None)[source]¶
Plot an image representation of voxel intensities across time.
This kind of plot is known as “carpet plot” or “Power plot”. See Jonathan Power Neuroimage 2017 Jul 1; 154:150-158.
- Parameters:
data (N x T
numpy.array) – The functional data to be plotted (N sampling locations by T timepoints).segments (
dict, optional) – A mapping between segment labels (e.g., “Left Cortex”) and list of indexes in the data array.cmap (colormap) – Overrides the generation of an automated colormap.
tr (float , optional) – Specify the TR, if specified it uses this value. If left as None, # of frames is plotted instead of time.
detrend (
bool, optional) – Detrend and standardize the data prior to plotting.subplot (matplotlib subplot, optional) – Subplot to plot figure on.
title (string, optional) – The title displayed on the figure.
output_file (string, or None, optional) – The name of an image file to export the plot to. Valid extensions are .png, .pdf, .svg. If output_file is not None, the plot is saved to a file, and the display is closed.
size (
tuple) – Maximum number of samples to plot (voxels, timepoints)sort_rows (
strorFalseorNone) – Apply a clustering algorithm to reorganize the rows of the carpet."",False, andNoneskip clustering sorting."linkage"uses linkage hierarchical clusteringscipy.cluster.hierarchy.linkage. Any other value that Python evaluates toTruewill use the default clustering, which issklearn.cluster.ward_tree.
- nireports.reportlets.nuisance.plot_dist(main_file, mask_file, xlabel, distribution=None, xlabel2=None, figsize=(11.69, 8.27))[source]¶
- nireports.reportlets.nuisance.plot_fd(fd_file, fd_radius, mean_fd_dist=None, figsize=(11.69, 8.27))[source]¶
- nireports.reportlets.nuisance.plot_qi2(x_grid, ref_pdf, fit_pdf, ref_data, cutoff_idx, out_file=None)[source]¶
- nireports.reportlets.nuisance.plot_raincloud(data_file, group_name, feature, palette='Set2', orient='v', density=True, upper_limit_value=None, upper_limit_color='gray', lower_limit_value=None, lower_limit_color='gray', limit_offset=None, mark_nans=True, nans_value=None, nans_color='black', figure=None, output_file=None)[source]¶
Generate a raincloud plot with the data points corresponding to the
featurevalue contained in the data file. Ifupper_limit_valueorlower_limit_valueis provided, the values outside that range are clipped. Thus, a large density around those values, together with the values plot with the distinctiveupper_limit_colorandlower_limit_colorstyles may be indicative of unexpected values in the data. Similarly, NaN values, if present, will be marked with the distinctivenans_colorstyle, and may again be indicative of unexpected values in the data.- Parameters:
data_file (
str) – File containing the data of interest.figure (
matplotlib.pyplot.figureor None) – Existing figure on which to plot.group_name (
str) – The group name of interest to be plot.feature (
str) – The feature of interest to be plot.palette (
str, optional) – Color palette name provided tosns.stripplot().orient (
str, optional) – Plot orientation (vorh).density (
bool, optional) –Trueto plot the density of the data points.upper_limit_value (
float, optional) – Upper limit value over which any value in the data will be styled with a different style.upper_limit_color (
str, optional) – Color name to represent values overupper_limit_value.lower_limit_value (
float, optional) – Lower limit value under which any value in the data will be styled with a different style.lower_limit_color (
str, optional) – Color name to represent values underlower_limit_value.limit_offset (
float, optional) – Offset to plot the values over/under the upper/lower limit values.mark_nans (
bool, optional) –Trueto plot NaNs as dots.nans_valuesmust be provided if True.nans_value (
float, optional) – Value to use for NaN values.nans_color (
str, optional) – Color name to represent NaN values.output_file (
strorNone) – Path where the output figure should be saved. If this is not defined, then the plotting axes will be returned instead of the saved figure path.
- Returns:
axes and gridspec – Plotting axes and gridspec. Returned only if
output_fileisNone.output_file (
str) – The file where the figure is saved.