Getting-Started
Getting Started with Colight
Colight is a powerful data visualization library that combines the expressiveness of Python with the interactivity of JavaScript. This guide will walk you through creating your first interactive visualizations.
Your First Plot
Let's start with a simple line plot. In Colight, we use the Observable Plot API through Python:
Create a line plot
Plot.line({"x": x, "y": y}, {"stroke": "steelblue", "strokeWidth": 2})
Adding Interactivity
One of Colight's strengths is its ability to create interactive visualizations. Let's add a slider to control the amplitude:
Now we can use this slider value in our plot:
interactive_plot | slider
Composing Multiple Visualizations
Colight makes it easy to compose multiple plots. You can arrange them horizontally with |
or vertically with &
:
Create two different wave forms
Display them side by side
sine_wave | cosine_wave
Working with Real Data
Let's create a more realistic example using random data to simulate stock prices:
Create a stock price chart with area fill
stock_chart