Polar Line Plot
Polar line plots are a type of data visualization that represents data points on a polar coordinate system. They display data as connected line segments extending from the center of a circular plot, often used to illustrate relationships, trends, or patterns within data that have angular or periodic dependencies.
Polar line plots are appropriate when the data contain a continuous variable represented in polar coordinates, with a radial and an angular component instead of the typical x and y components. Further, polar line plots are preferable to polar scatter plots when the explanatory variables are ordered.
What are polar line plots useful for?
- Cyclical data analysis: They are ideal for analyzing cyclical or periodic data, such as daily temperature fluctuations, seasonal patterns, or circular processes in physics and engineering.
- Representing directional data: Polar line plots are valuable for representing directional data, such as wind direction, compass bearings, or circular measurements, offering a clear way to visualize and analyze these kinds of patterns.
- Phase or angular relationships: When assessing phase shifts, angular dependencies, or correlations in data, polar line plots provide an intuitive representation for understanding relationships within circular data.
Examples
A basic polar line plot
Visualize a dataset in polar coordinates by passing column names to the r
and theta
arguments. theta
may be a string of cardinal directions, as in this example. theta
also supports the use of numeric types that may represent radians or degrees, depending on how the range_theta
argument is supplied.
import deephaven.plot.express as dx
wind = dx.data.wind()
# `by` is used to separate data by groups
polar_line_plot = dx.line_polar(wind, r="Frequency", theta="Direction", by="Strength")
API Reference
Returns a polar scatter chart
Returns: DeephavenFigure
A DeephavenFigure that contains the polar scatter chart
Parameters | Type | Default | Description |
---|---|---|---|
table | PartitionedTable | Table | DataFrame | A table to pull data from. | |
r | str | None | None | A column that contains r values. |
theta | str | None | None | A column that contains theta values. |
by | str | list[str] | None | None | A column or list of columns that contain values to plot the figure traces by. All values or combination of values map to a unique design. The variable by_vars specifies which design elements are used. This is overriden if any specialized design variables such as color are specified |
by_vars | str | list[str] | 'color' | A string or list of string that contain design elements to plot by. Can contain size, line_dash, width, color, and symbol. If associated maps or sequences are specified, they are used to map by column values to designs. Otherwise, default values are used. |
size | str | None | None | A column or list of columns that contain size values. If only one column is passed, and it contains numeric values, the value is used as a size. Otherwise, the value is used for a plot by on size. See size_map for additional behaviors. |
line_dash | str | list[str] | None | None | A column or list of columns that contain line_dash values. The value is used for a plot by on line_dash. See line_dash_map for additional behaviors. |
width | str | list[str] | None | None | A column or list of columns that contain width values. The value is used for a plot by on width. See width_map for additional behaviors. |
color | str | list[str] | None | None | A column or list of columns that contain color values. The value is used for a plot by on color. See color_discrete_map for additional behaviors. |
symbol | str | list[str] | None | None | A column or list of columns that contain symbol values. The value is used for a plot by on symbol. See color_discrete_map for additional behaviors. |
text | str | None | None | A column that contains text annotations. |
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. |
line_dash_sequence | list[str] | None | None | A list of line dashes to sequentially apply to the series. The dashes loop, so if there are more series than dashes, dashes will be reused. |
line_dash_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 line_dash. |
symbol_sequence | list[str] | None | None | A list of symbols to sequentially apply to the markers in the series. The symbols loop, so if there are more series than symbols, symbols will be reused. |
symbol_map | str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | 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 symbols. If "identity", the values are taken as literal symbols. If "by" or ("by", dict) where dict is as described above, the symbols are forced to by |
size_sequence | list[int] | None | None | A list of sizes to sequentially apply to the markers in the series. The sizes loop, so if there are more series than symbols, sizes will be reused. |
size_map | str | tuple[str, dict[str | tuple[str], dict[str | tuple[str], str]]] | 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 sizes. If "identity", the values are taken as literal sizes. If "by" or ("by", dict) where dict is as described above, the sizes are forced to by |
width_sequence | list[int] | None | None | A list of widths to sequentially apply to the series. The widths loop, so if there are more series than widths, widths will be reused. |
width_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 width. |
markers | bool | False | True to draw markers on the line, False to not. Default False |
direction | str | 'clockwise' | Which direction points are drawn. Can be 'clockwise' or 'counterclockwise' |
start_angle | int | 90 | Sets start angle. |
line_close | bool | False | True draw a line between first and last point, False to not. |
line_shape | str | 'linear' | The line shape for all lines created. One of 'linear', 'spline'. |
range_r | list[int] | None | None | A list of two numbers that specify the range of r. |
range_theta | list[int] | None | None | A list of two numbers that specify the range of theta. |
log_r | bool | False | A boolean that specifies if the corresponding axis is a log axis or not. |
title | str | None | None | The title of the chart |
template | str | None | None | The template for the chart. |
render_mode | str | 'svg' | Either "svg" or "webgl". Setting to "webgl" will lead to a more performant plot but there may be graphical bugs. |
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. |