Polar Charts in Python

How to make polar charts in Python with Plotly.


Plotly Studio: Transform any dataset into an interactive data application in minutes with AI. Try Plotly Studio now.

Polar chart with Plotly Express

A polar chart represents data along radial and angular axes. With Plotly Express, it is possible to represent polar data as scatter markers with px.scatter_polar, and as lines with px.line_polar.

Plotly Express is the easy-to-use, high-level interface to Plotly, which operates on a variety of types of data and produces easy-to-style figures.

For other types of arguments, see the section below using go.Scatterpolar.

The radial and angular coordinates are given with the r and theta arguments of px.scatter_polar. In the example below the theta data are categorical, but numerical data are possible too and the most common case.

In [1]:
import plotly.express as px
df = px.data.wind()
fig = px.scatter_polar(df, r="frequency", theta="direction")
fig.show()

The "strength" column corresponds to strength categories of the wind, and there is a frequency value for each direction and strength. Below we use the strength column to encode the color, symbol and size of the markers.

In [2]:
import plotly.express as px
df = px.data.wind()
fig = px.scatter_polar(df, r="frequency", theta="direction",
                       color="strength", symbol="strength", size="frequency",
                       color_discrete_sequence=px.colors.sequential.Plasma_r)
fig.show()

For a line polar plot, use px.line_polar:

In [3]:
import plotly.express as px
df = px.data.wind()
fig = px.line_polar(df, r="frequency", theta="direction", color="strength", line_close=True,
                    color_discrete_sequence=px.colors.sequential.Plasma_r,
                    template="plotly_dark",)
fig.show()

See also the wind rose page for more wind rose visualizations in polar coordinates.

You can plot less than a whole circle with the range_theta argument, and also control the start_angle and direction:

In [4]:
import plotly.express as