deepgraph.deepgraph.DeepGraph.plot_hist

static DeepGraph.plot_hist(x, bins=10, log_bins=False, density=False, floor=False, ax=None, **kwargs)[source]

Plot a histogram (or pdf) of x.

Compute and plot the histogram (or probability density) of x. Keyword arguments are passed to plt.plot. See parameters and np.histogram for details.

Parameters:
  • x (array_like) – The data from which a frequency distribution is plot.
  • bins (int or array_like, optional (default=10)) – If bins is an int, it determines the number of bins to create. If log_bins is True, this number determines the (approximate) number of bins to create for each magnitude. For linear bins, it is the number of bins for the whole range of values. If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths.
  • log_bins (bool, optional (default=False)) – Whether to use logarithmically or linearly spaced bins.
  • density (bool, optional (default=False)) – If False, the result will contain the number of samples in each bin. If True, the result is the value of the probability density function at the bin, normalized such that the integral over the range is 1. Note that the sum of the histogram values will not be equal to 1 unless bins of unity width are chosen; it is not a probability mass function.
  • floor (bool, optional (default=False)) – Whether to floor the bin edges to the closest integers. Only has an effect if bins is an int.
  • ax (matplotlib axes object, optional (default=None)) – An axes instance to use.
Returns:

  • ax (matplotlib axes object) – A matplotlib axes instance.
  • hist (np.ndarray) – The values of the histogram. See density.
  • bin_edges (np.ndarray) – The edges of the bins.