Plot radial frequency against direction
Directional measurements such as wind observations
Plotly · Function
px.line_polar creates an interactive polar line chart by mapping values to radial (r) and angular (theta) coordinates. It supports grouping, closed paths, and radar-style visualizations.
px.line_polar maps a radial value to r and an angular value to theta, then builds one or more polar line traces from the supplied data. Optional grouping, styling, labeling, animation, and layout arguments control how the resulting figure is presented; the function returns a fully populated Plotly figure that can be displayed or further edited.
px.line_polar(data_frame=None, r=None, theta=None, color=None, line_dash=None, hover_name=None, ... )| Name | Type | Description |
|---|---|---|
data_frame, r, theta, color, ... | DataFrame or array-like values; additional Plotly Express keyword arguments | Input data or column mappings used to construct the figure; the function accepts a data frame followed by radial, angular, grouping, and styling arguments. |
A plotly.graph_objects.Figure containing the polar line chart.
px.line_polar.line_close=True when the plotted path should connect its final point back to its first point, such as for radar-style charts.import plotly.express as px
df = px.data.wind()
fig = px.line_polar(
df,
r="frequency",
theta="direction",
color="strength",
line_close=True,
)
fig.show()Creates a polar line chart from Plotly's built-in wind dataset, grouping lines by strength and closing each line.
Directional measurements such as wind observations
Multidimensional categorical comparisons
Several series sharing polar coordinates
r and theta arguments represent?r supplies the radial coordinate and theta supplies the angular coordinate. The function uses those columns or array-like values to construct a polar line plot, optionally splitting the data into groups such as those specified by color.
Follow-up: How would you create a radar-style chart? Set theta to categorical dimensions, use numeric values for r, and pass line_close=True; a filled version can be made by updating the resulting traces with fill='toself'.
px.line_polar return, and how can it be customized?The function returns a Plotly Figure. That figure can be displayed with fig.show() and modified afterward with standard figure methods such as update_layout or update_traces.
Follow-up: How can the same figure be filled? Call fig.update_traces(fill='toself') after constructing it.
color groups observations into separate polar lines and assigns their visual differentiation. line_close=True closes each path by connecting its endpoint to its starting point, which is useful for radar charts.
Follow-up: How can several dimensions be shown without separate groups? Keep one group and encode the dimensions in categorical theta values, then close the line.
px.scatter_polarpx.bar_polarplotly.graph_objects.Figurescatterpolar