Plotting of results¶
-
class
fret_tester.
Plotter2D
(**kwargs)[source]¶ Class for producing 2D plots
These are typically plots of where the two lifetimes were tested independently, producing a 2D plot with the p-values color-coded.
-
make_axes
(nrows, n, ax_or_subspec, fig, colorbar='on')¶ Create matplotlib Axes objects for plotting
Parameters: - nrows (int) – Number of rows. Only has an effect if ax_or_subspec is a
SubplotSpec
instance. - n (int) – Number plotss. Only has an effect if ax_or_subspec is a
SubplotSpec
instance. - ax_or_subspec (list of matplotlib Axes or matplotlib SupblotSpec or None) – If this is a
SubplotSpec
instance, create new Axes on a grid in ax_or_subspec. If this is a list of Axes, just use those. If None, create aSubplotSpec
that fills the whole figure. - fig (matplotlib.figure.Figure) – Figure to create the Axes on. Only applicable if ax_or_subspec
is a
SubplotSpec
instance. - colorbar ({“on”, “empty”, “off”}, optional) – If “on” or “empty”, create addtional Axes (of
cbar_width
width) intended for a colorbar (if ax_or_subspec is aSubplotSpec
instance) or use the last element of ax_or_subspec as colorbar Axes (if it is a list of Axes). Defaults to “on”.
Returns: - ax (list of matplotlib.axes.Axes) – Axes for plots
- cbar_ax (matplotlib.axes.Axes or None) – Axes for colorbar (if colorbar is “on” or “empty”) or None (if colorbar is “off”).
- nrows (int) – Number of rows. Only has an effect if ax_or_subspec is a
-
time_unit
¶ String describing the time unit
This is used in axis labels.
-
norm
= <matplotlib.colors.LogNorm object>¶ p-value color map normalization. Logarithmic by default.
-
pval_range
= (0.01, 1.0)¶ p-value range
-
cmap
= 'binary'¶ p-value color map
-
plot
(test_times, p_vals, truth=None, ax=None)[source]¶ Draw a single 2D plot
These is typically for plots of where the two lifetimes were tested independently, producing a 2D plot with the p-values color-coded.
Parameters: - test_times (list of lists of float) – test_times[0] specifies the times the first lifetime :math:` au_1` was tested against. test_times[1] specify the times the second lifetime :math:` au_2` was tested against.
- p_vals (array_like, dtype(float), shape(len(test_times[0], len(test_times[1]))) – p-values corresponding to test_times
- truth (tuple of float or None, optional) – If not None, draw lines at these time coordinates to mark the true lifetime combination (if known). Defaults to None.
- ax (matplotlib.axes.Axes or None:) – Axes to draw on. Use
matplotlib.pyplot.gca()
if None. Defaults to None.
Returns: - ax (matplotlib.axes.Axes) – Axes for test_times[1]
- axt (matplotlib.axes.Axes) – Axes for test_times[0]
-
plot_series
(test_times, p_vals, truths=None, ax_or_subspec=None, fig=None, nrows=1)[source]¶ Draw a series of 2D plots
Use
plot()
to draw a series of plots on a grid.Parameters: - test_times (list) – Each entry will be passed to
plot()
as test_times parameter. - p_vals (list) – Each entry will be passed to
plot()
as p_vals parameter. - truths (list or None, optional) – Each entry will be passed to
plot()
as truth parameter. Defaults to None. - ax_or_subspec (list of matplotlib Axes or matplotlib SupblotSpec or None) – If this is a
SubplotSpec
instance, create new Axes on a grid in ax_or_subspec. If this is a list of Axes, just use those. If None, create aSubplotSpec
that fills the whole figure. - fig (matplotlib.figure.Figure or None) – Only effective if ax_or_subspec is a
SubplotSpec
instance. If None, usematplotlib.pyplot.gcf()
. Defaults to None. - nrows (int, optional) – Number of rows. Defaults to 1.
Returns: - ax (list of matplotlib.axes.Axes) – Axes for p-value plots.
- colorbar_ax (matplotlib.axes.Axes) – Axes for colorbar.
- fig (matplotlib.figure.Figure or None) – Only effective if ax_or_subspec is a
SubplotSpec
instance. If None, usematplotlib.pyplot.gcf()
. Defaults to None. - nrows (int, optional) – Number of rows. Defaults to 1.
Returns: - ax (list of matplotlib.axes.Axes) – Axes for p-value plots.
- colorbar_ax (matplotlib.axes.Axes) – Axes for colorbar.
- test_times (list) – Each entry will be passed to
-
-
class
fret_tester.
Plotter1D
(**kwargs)[source]¶ Class for producing 1D plots
These are typically plots of lifetimes vs. p-values with fixed ratio between the two lifetimes.
Parameters: **kwargs – Set any of the class attributes ( truth_style
, …)-
pval_scale
= 'log'¶ Scale for the p-value axis
-
significance
= 0.01¶ Significance threshold
-
pval_range
= (0.001, 1.0)¶ p-value axis range
-
make_axes
(nrows, n, ax_or_subspec, fig, colorbar='on')¶ Create matplotlib Axes objects for plotting
Parameters: - nrows (int) – Number of rows. Only has an effect if ax_or_subspec is a
SubplotSpec
instance. - n (int) – Number plotss. Only has an effect if ax_or_subspec is a
SubplotSpec
instance. - ax_or_subspec (list of matplotlib Axes or matplotlib SupblotSpec or None) – If this is a
SubplotSpec
instance, create new Axes on a grid in ax_or_subspec. If this is a list of Axes, just use those. If None, create aSubplotSpec
that fills the whole figure. - fig (matplotlib.figure.Figure) – Figure to create the Axes on. Only applicable if ax_or_subspec
is a
SubplotSpec
instance. - colorbar ({“on”, “empty”, “off”}, optional) – If “on” or “empty”, create addtional Axes (of
cbar_width
width) intended for a colorbar (if ax_or_subspec is aSubplotSpec
instance) or use the last element of ax_or_subspec as colorbar Axes (if it is a list of Axes). Defaults to “on”.
Returns: - ax (list of matplotlib.axes.Axes) – Axes for plots
- cbar_ax (matplotlib.axes.Axes or None) – Axes for colorbar (if colorbar is “on” or “empty”) or None (if colorbar is “off”).
- nrows (int) – Number of rows. Only has an effect if ax_or_subspec is a
-
time_unit
¶ String describing the time unit
This is used in axis labels.
-
significance_opts
= {'alpha': 0.4, 'color': 'gray', 'ls': 'None', 'lw': 0.001}¶ Options for plotting the region of significance
-
plot
(test_times, p_vals, truth=None, ax=None)[source]¶ Draw a single 1D plot
This is typically for plots of lifetimes vs. p-values with fixed ratio between the two lifetimes.
Parameters: - test_times (list of lists of float) – test_times[0] specifies the times the first lifetime :math:` au_1` was tested against. test_times[1] specify the times the second lifetime :math:` au_2` was tested against.
- p_vals (list of float) – p-values corresponding to test_times
- truth (tuple of float or None, optional) – If not None, draw lines at these time coordinates to mark the true lifetime combination (if known). Defaults to None.
- ax (matplotlib.axes.Axes or None:) – Axes to draw on. Use
matplotlib.pyplot.gca()
if None. Defaults to None.
Returns: - ax (matplotlib.axes.Axes) – Axes for test_times[1]
- axt (matplotlib.axes.Axes) – Axes for test_times[0]
-
plot_series
(test_times, p_vals, truths=None, ax_or_subspec=None, fig=None, nrows=1, empty_cbar=False)[source]¶ Draw a series of 1D plots
Use
plot()
to draw a series of plots on a grid.Parameters: - test_times (list) – Each entry will be passed to
plot()
as test_times parameter. - p_vals (list) – Each entry will be passed to
plot()
as p_vals parameter. - truths (list or None, optional) – Each entry will be passed to
plot()
as truth parameter. Defaults to None. - ax_or_subspec (list of matplotlib Axes or matplotlib SupblotSpec or None) – If this is a
SubplotSpec
instance, create new Axes on a grid in ax_or_subspec. If this is a list of Axes, just use those. If None, create aSubplotSpec
that fills the whole figure. - fig (matplotlib.figure.Figure or None) – Only effective if ax_or_subspec is a
SubplotSpec
instance. If None, usematplotlib.pyplot.gcf()
. Defaults to None. - nrows (int, optional) – Number of rows. Defaults to 1.
- empty_cbar (bool, optional) – Whether to allocate an (emtpy) grid entry for a colorbar. This is useful if the plot series is paired with a 2D series (with a color bar) in the same figure. Defaults to False.
Returns: - ax (list of matplotlib.axes.Axes) – Axes for
tt[1]
, wherett
stands for each entry of test_times. - axt (list of matplotlib.axes.Axes) – Axes for
tt[0]
, wherett
stands for each entry of test_times.
- test_times (list) – Each entry will be passed to
-