magmaviz.histogram
Module Contents
Functions
|
Plot a histogram with the magma color scheme |
|
A helper function to validate input y |
- magmaviz.histogram.histogram(df, x, y)[source]
Plot a histogram with the magma color scheme
- Parameters
df (dataframe) – Dataframe containing the variables for plotting
x (string) – Column name of the variable to be plotted on the x-axis
y (string) – An aggregation function to be plotted on the y-axis. The supported aggregation operations are: [‘average’, ‘count’, ‘distinct’, ‘max’, ‘mean’, ‘median’, ‘min’, ‘missing’, ‘product’, ‘q1’, ‘q3’, ‘ci0’, ‘ci1’, ‘stderr’, ‘stdev’, ‘stdevp’, ‘sum’, ‘valid’, ‘values’, ‘variance’, ‘variancep’]
- Returns
A histogram displaying distribution based on the aggregation function
- Return type
altair.vegalite.v4.api.Chart
Examples
>>> from magmaviz.histogram import histogram >>> histogram(mtcars, "cars", "count()")
- magmaviz.histogram.validate(df, y)[source]
A helper function to validate input y :param df: The input dataframe :type df: dataframe :param y: The user specified aggregation function to be plotted on the y-axis.
The supported aggregation operations are: [‘average’, ‘count’, ‘distinct’, ‘max’, ‘mean’, ‘median’, ‘min’, ‘missing’, ‘product’, ‘q1’, ‘q3’, ‘ci0’, ‘ci1’, ‘stderr’, ‘stdev’, ‘stdevp’, ‘sum’, ‘valid’, ‘values’, ‘variance’, ‘variancep’]
- Return type
This function only raises errors
Examples
>>> validate(data.iris(), 'mean(petalLength)') >>> validate(data.iris(), 'count()')