hic3defdr.plotting.dispersion module

hic3defdr.plotting.dispersion.compare_disp_fits(fit_fns, labels, max_dist=200, colors=None, linestyles=None, legend=True, **kwargs)[source]

Compares multiple dispersion fit functions.

Parameters:
  • fit_fns (list of functions) – The fit functions to compare. Each function should be vectorized and take one argument (the distance) and return one value (the fitted dispersion at that distance).
  • labels (list of str) – The labels to use for each fit function being compared.
  • max_dist (int) – The maximum distance out to which the plot should be drawn.
  • colors (list of valid matplotlib colors, optional) – Pass a list of colors to color each fit function with. Pass None to color them automatically.
  • linestyles (list of valid matplotlib linestyles, optional) – Pass a list of linestyles to plot each fit function with. Pass None to use the default linestyle.
  • legend (bool) – Pass True to include a legend on the plot.
  • kwargs (kwargs) – Typical plotter kwargs.
Returns:

The axis plotted on.

Return type:

pyplot axis

hic3defdr.plotting.dispersion.plot_ddr(dist_per_bin, disp_per_bin, disp_fn, scatter_size=36, legend=True, **kwargs)[source]

Simplified plotter to visualized distance-dispersion relationships.

Plots per-distance dispersion estimates and the fitted dispersion curve.

Parameters:
  • disp_per_bin (dist_per_bin,) – The distances and estimated dispersions for each distance, respectively.
  • disp_fn (function) – The smoothed dispersion function. Returns the smoothed dispersion as a function of distance.
  • scatter_size (int) – The marker size when plotting scatter plots.
  • kwargs (kwargs) – Typical plotter kwargs.
Returns:

The axis plotted on.

Return type:

pyplot axis

hic3defdr.plotting.dispersion.plot_mvr(pixel_mean, pixel_var=None, pixel_disp=None, pixel_dist=None, pixel_var_fit=None, pixel_disp_fit=None, mean_per_bin=None, dist_per_bin=None, var_per_bin=None, disp_per_bin=None, fit_align_dist=False, xaxis='mean', yaxis='var', dist_max=200, mean_min=5.0, scatter_fit=-1, scatter_size=36, hexbin=True, logx=True, logy=True, xlim=None, ylim=None, legend=True, **kwargs)[source]

Plots pixel-wise, bin-wise, and estimated dispersions in terms of either dispersion or variance versus either pixel-wise mean or distance.

Parameters:
  • pixel_mean (np.ndarray) – The pixel-wise mean.
  • pixel_disp (pixel_var,) – The pixel-wise variance and dispersion. Pass only one of these.
  • pixel_dist (np.ndarray, optional) – The pixel-wise distance. Not needed for simple MVR plotting.
  • pixel_disp_fit (pixel_var_fit,) – The smoothed pixel-wise variance or dispersion estimates. Pass only one of these.
  • dist_per_bin (mean_per_bin,) – The mean or distance of each bin used for estimating the dispersions but before any smoothing was performed. Pass only one of these.
  • disp_per_bin (var_per_bin,) – The estimated variance or dispersion of each bin before any smoothing was performed. Pass only one of these.
  • fit_align_dist (bool) – Pass True if the var/disp was fitted as a function of distance, in which case the fitted vars/disps will be aligned to distance rather than in a pixel-wise fashion. Use this to fix “jagged” fit lines caused by setting xaxis to a different value than the one the fitting was actually performed against.
  • xaxis ('mean' or 'dist') – What to plot on the x-axis.
  • yaxis ('var' or 'disp') – What to plot on the y-axis.
  • dist_max (int) – If xaxis is “dist”, the maximum distance to plot in bin units.
  • mean_min (float) – If xaxis is “mean”, the minimum mean to plot.
  • scatter_fit (int) – Pass a nonzero integer to draw the fitted vars/disps as a scatter plot of scatter_fit selected points. Pass -1 to plot the fitted vars/disps as a curve. Pass 0 to omit plotting the var/disp estimates altogether.
  • scatter_size (int) – The marker size when plotting scatter plots.
  • hexbin (bool) – Pass False to skip plotting the hexbins, leaving only the estimated variances or dispersions.
  • logy (logx,) – Whether or not to log the x- or y-axis, respectively.
  • kwargs (kwargs) – Typical plotter kwargs.
Returns:

The axis plotted on.

Return type:

pyplot axis