plot_distribution_as_percentiles

typhon.plots.plot_distribution_as_percentiles(ax, x, y, nbins=10, bins=None, ptiles=(5, 25, 50, 75, 95), linestyles=(':', '--', '-', '--', ':'), ptile_to_legend=True, label=None, **kwargs)[source]

Plot the distribution of y vs. x as percentiles.

Bin y-data according to x-data (using typhon.math.stats.bin()). Then, within each bin, show the distribution by plotting percentiles.

Parameters:
  • ax (AxesSubplot) – matplotlib axes to plot into

  • x (ndarray) – data for x-axis

  • y (ndarray) – data for y-axis

  • nbins (int) – Number of bins to use for dividing the x-data.

  • bins (ndarray) – Specific bins to use for dividing the x-data. Supersedes nbins.

  • ptiles (ndarray) – Percentiles to visualise.

  • linestyles (List[str]) – List of linestyles corresponding to percentiles

  • ptile_to_legend (bool) – True: Add a label to each percentile. False: Only add a legend to the median.

  • label (str or None) – Label to use in legend.

  • **kwargs – Remaining arguments passed to AxesSubplot.plot(). You probably want to pass at least color.