hist_2d

hhpy.plotting.hist_2d(x: str, y: str, data: pandas.core.frame.DataFrame, bins: int = 100, std_cutoff: int = 3, cutoff_perc: float = 0.01, cutoff_abs: float = 0, cmap: str = 'rainbow', ax: matplotlib.axes._axes.Axes = None, color_sigma: str = 'xkcd:red', draw_sigma: bool = True, **kwargs) → matplotlib.axes._axes.Axes[source]

generic 2d histogram created by splitting the 2d area into equal sized cells, counting data points in them and drawn using pyplot.pcolormesh

Parameters:
  • x – Name of the x variable in data or vector data
  • y – Name of the y variable in data or vector data
  • data – Pandas DataFrame containing named data, optional if vector data is used
  • bins – Nr of bins of the histogram [optional]
  • std_cutoff – Remove data outside of std_cutoff standard deviations, for a good visual experience try 3 [optional]
  • cutoff_perc – if less than this percentage of data points is in the cell then the data is ignored [optional]
  • cutoff_abs – if less than this amount of data points is in the cell then the data is ignored [optional]
  • cmap – Color map to use [optional]
  • ax – The matplotlib.pyplot.Axes object to plot on, defaults to current axis [optional]
  • color_sigma – color to highlight the sigma range in, must be a valid pyplot.plot color [optional]
  • draw_sigma – whether to highlight the sigma range [optional]
  • kwargs – other keyword arguments passed to pyplot.pcolormesh [optional]
Returns:

The matplotlib.pyplot.Axes object with the plot on it