Funnel Area Plot
A funnel area plot is a data visualization that is typically used to represent data where values progressively decrease or “funnel” through stages or categories. It takes the form of a series of horizontally aligned trapezoids or polygons, with each stage’s area proportional to the quantity it represents, making it a useful tool for visualizing the attrition or progression of data through a sequential process. The data must be ordered by the response variable, or the “funnel” shape will not be guaranteed.
Funnel area plots differ from funnel plots in that they display the percentage of data points that belong to each category, while funnel plots display the absolute count of data points in each category. Funnel area plots also count each data point as belonging to exactly one category and display the categories as mutually exclusive. On the other hand, funnel plots count each data point as belonging to at least one category, so the categories are represented as subsets of each other rather than mutually exclusive.
Funnel area plots are appropriate when the data contain a categorical variable where the frequencies of each category can be computed, and the categories can be ordered. Additionally, funnel plots assume a particular relationship between levels of the categorical variable, where each category is a proper subset of the previous category. If the data contain an unordered categorical variable, or the categories are better conceptualized as parts of a whole, consider a pie plot instead of a funnel area plot.
What are funnel area plots useful for?
- Visualizing sequential data: Data that are staged or sequential in some way are often visualized with funnel area plots, yielding insight on the rate of change from one stage to the next.
- Analyzing data progression: Funnel area plots may be used for analyzing attrition, conversion rates, or transitions between stages.
- Evaluating efficiency: Assessing the efficiency and effectiveness of a process or workflow is easy with funnel area plots.
Examples
A basic funnel plot
Visualize the trend in consecutive stages of a categorical variable by passing column names to the names
and values
arguments.
import deephaven.plot.express as dx
marketing = dx.data.marketing()
# `Count` is the frequency/value column, and `Stage` is the category column
funnel_area_plot = dx.funnel_area(marketing, names="Stage", values="Count")
API Reference
Returns a funnel area chart
Returns: DeephavenFigure
A DeephavenFigure that contains the funnel area chart
Parameters | Type | Default | Description |
---|---|---|---|
table | Table | DataFrame | A table to pull data from. | |
names | str | None | None | The column containing names of the sections |
values | str | None | None | The column containing values of the sections |
color | str | list[str] | None | None | A column or list of columns that contain color values. If only one column is passed, and it contains numeric values, the value is used as a value on a continuous color scale. Otherwise, the value is used for a plot by on color. See color_discrete_map for additional behaviors. |
hover_name | str | None | None | A column that contains names to bold in the hover tooltip. |
labels | dict[str, str] | None | None | A dictionary of labels mapping columns to new labels. |
color_discrete_sequence | list[str] | None | None | A list of colors to sequentially apply to the series. The colors loop, so if there are more series than colors, colors will be reused. |
color_discrete_map | dict[str | tuple[str], str] | None | None | If dict, the keys should be strings of the column values (or a tuple of combinations of column values) which map to colors. |
title | str | None | None | The title of the chart |
template | str | None | None | The template for the chart. |
opacity | float | None | None | Opacity to apply to all markers. 0 is completely transparent and 1 is completely opaque. |
unsafe_update_figure | Callable | <function default_callback> | An update function that takes a plotly figure as an argument and optionally returns a plotly figure. If a figure is not returned, the plotly figure passed will be assumed to be the return value. Used to add any custom changes to the underlying plotly figure. Note that the existing data traces should not be removed. This may lead to unexpected behavior if traces are modified in a way that break data mappings. |