PlotUtils#

Plotting routines for ClearMap based on matplotlib.

Note

This module is using matplotlib.

fold_sample_stats_dataframe(df, aba_df, fold_threshold)[source]#
get_parent_id(df, _id, level)[source]#
get_parent_name(df, _id, level)[source]#
get_parent_structure(df, _id, level)[source]#
get_prop_from_aba_df(aba_df, ids, prop_name)[source]#
get_structure_colors(stats_df, id_col_name='Structure ID')[source]#
gp_stats_df_to_counts(df)[source]#

stack the df by group name The only counts are the average for the group A new column identifies the group. It is aimed to make it interchangeable with the DF of an individual sample

Parameters:
  • pd.DataFrame (Returns)

  • pd.DataFrame

  • -------

handle_fig_fate(fig, show, save_path)[source]#
is_gp_stats_df(df)[source]#
plot_curve(coordinates, **kwargs)[source]#

Plot a curve in 3d.

Arguments

coordinatesnx3 array.

The coordinates of the curve.

kwargs

Matplotlib parameter.

Returns

axax

3d axes object.

plot_density(points, plot_points=True, plot_contour=True, plot_contour_lines=10, n_bins=100, color=None, cmap=<matplotlib.colors.LinearSegmentedColormap object>, xlim=None, ylim=None, verbose=False)[source]#

Plot point distributions.

plot_sample_stats_histogram(stats_df, aba_df, sort_by_order=False, split_criterion='hemisphere', metric_name='density', value_cutoff=0.05, fold_threshold=5, fold_regions=False, save_path=None, show=True)[source]#
plot_sub_df(sub_df, i, axes, titles, criterion_name, sort_by_order=False, struct_name_str='Structure name', struct_acronym_str='Acronym', struct_color_str='color', struct_order_str='Structure order')[source]#
plot_volcano(df, group_names, p_cutoff=0.05, show=False, save_path='')[source]#
subplot_tiling(n, tiling=None)[source]#

Finds a good tiling to arrange subplots.

Arguments

nint

Number of subplots.

tilingNone, ‘automatic, int or tuple

The tiling to use. If None or ‘automatic’ calculate automatically. If number use this for the number of subplots along the horizontal axis. If tuple, (nx,ny) nx and ny can be numbes or None to indicate the number of sub-plots in each axis. Iif one of them is None, it will be determined automatically to fit the total number of plots.

Returns

tilingtuple of int

The subplot tiling.