Histogram
simple_histogram(data, show_legend=True, opacity=0.75, title='Histogram', x_label='x', y_label='y', size=None, plotly_kwargs=None, show=True, write_html_path=None)
¶
Create a simple histogram from a pandas DataFrame, numpy array, or list of values.
Example:
import numpy as np
from blitzly.plots.histogram import simple_histogram
foo = np.random.randn(500)
bar = np.random.randn(500) + 1
data = np.array([foo, bar])
simple_histogram(
data,
title="Histogram of foo and bar",
x_label="Value",
y_label="Count",
write_html_path="the_blitz.html"
)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Union[pd.DataFrame, pd.Series, NDArray]
|
The data which should be plotted. Either one or multiple columns of data. |
required |
show_legend |
Optional[bool]
|
Whether to show the legend. |
True
|
opacity |
Optional[float]
|
The opacity of the histogram. |
0.75
|
title |
Optional[str]
|
The title of the histogram. |
'Histogram'
|
x_label |
Optional[str]
|
The label of the x-axis. |
'x'
|
y_label |
Optional[str]
|
The label of the y-axis. |
'y'
|
size |
Optional[Tuple[int, int]
|
Size of the plot. |
None
|
plotly_kwargs |
Optional[dict]
|
Additional keyword arguments to pass to Plotly |
None
|
show |
bool
|
Whether to show the figure. |
True
|
write_html_path |
Optional[str]
|
The path to which the histogram should be written as an HTML file. If None, the histogram will not be saved. |
None
|