Skip to main content
v2.2

Polar Scatter Points

Polar Point SeriesPolar Point Series
import lightningchart as lc
import numpy as np

# Set your license key here
lc.set_license('my-license-key')

# Create the polar chart
chart = lc.PolarChart(theme=lc.Themes.Light, title="Polar Point")

# Define angles (0 to 360 degrees, 90 points)
angles = np.linspace(0, 360, 90)

# Add four separate point series for four petals
petal_1 = chart.add_point_series()
petal_2 = chart.add_point_series()
petal_3 = chart.add_point_series()
petal_4 = chart.add_point_series()

# Define amplitude data for each petal, based on distinct transformations
data_petal_1 = [{'angle': i, 'amplitude': 0.5 * (1 + np.sin(np.radians(i)))} for i in angles]
data_petal_2 = [{'angle': i, 'amplitude': 0.5 * (1 + np.sin(np.radians(i + 90)))} for i in angles]
data_petal_3 = [{'angle': i, 'amplitude': 0.5 * (1 + np.sin(np.radians(i + 180)))} for i in angles]
data_petal_4 = [{'angle': i, 'amplitude': 0.5 * (1 + np.sin(np.radians(i + 270)))} for i in angles]

# Assign data to each petal series
petal_1.set_data(data_petal_1)
petal_2.set_data(data_petal_2)
petal_3.set_data(data_petal_3)
petal_4.set_data(data_petal_4)

# Set distinct shapes, sizes, and colors for each petal
petal_1.set_point_shape('circle').set_point_size(10).set_point_color(color=('red'))
petal_2.set_point_shape('square').set_point_size(10).set_point_color(color=('green'))
petal_3.set_point_shape('diamond').set_point_size(10).set_point_color(color=('blue'))
petal_4.set_point_shape('cross').set_point_size(10).set_point_color(color=('yellow'))

chart.open()