quick_anomaly_detector.data_process.graph_multiple_histograms

quick_anomaly_detector.data_process.graph_multiple_histograms(df, columns, layout=(2, 2), bin_numbers=None)

Plot multiple histograms of specified columns from a DataFrame.

Parameters:
  • df (pandas.DataFrame) – The pandas DataFrame containing the data.

  • columns (list) – List of column names to be plotted.

  • layout (tuple, optional) – Tuple specifying the layout dimensions of subplots. Default is (2, 2).

  • bin_numbers (list, optional) – List of integers specifying the number of bins for each column.

Returns:

The generated matplotlib Figure object containing the histograms.

Return type:

matplotlib.figure.Figure

Example:

from quick_anomaly_detector.data_process import graph_multiple_histograms

columns_to_plot = ['a', 'b', 'c', 'd']
bin_numbers = [10, 20, 15, 10]  # Example list of bin numbers corresponding to each column
fig = graph_multiple_histograms(df, columns_to_plot, layout=(2, 2), bin_numbers=bin_numbers)
plt.show()