Back to all articles

Getting Started with Elixir Data Exploration

05 December 2025 1 min read
0 reading now Interactive

Getting Started with Elixir Data Exploration

This document demonstrates how to use Elixir and Livebook for interactive data exploration. We'll learn basic data processing, visualization, and analysis techniques.

What you'll learn:

  • Processing collection data with the Enum module
  • Creating interactive tables with Kino
  • Data visualization with VegaLite

Setup

First, let's install the necessary dependencies:

Mix.install([
  {:kino, "~> 0.12"},
  {:vega_lite, "~> 0.1"},
  {:kino_vega_lite, "~> 0.1"}
])
:ok

Creating Sample Data

Let's create a dataset containing programming language popularity:

# Define programming language data
languages = [
  %{name:"Elixir", year:2011, type:"Functional", popularity:85},
  %{name:"Rust", year:2010, type:"Systems", popularity:92},
  %{name:"Go", year:2009, type:"Systems", popularity:88},
  %{name:"TypeScript", year:2012, type:"Scripting", popularity:95},
  %{name:"Kotlin", year:2011, type:"JVM", popularity:78},
  %{name:"Swift", year:2014, type:"Mobile", popularity:82}
]
[
  %{name: "Elixir", popularity: 85, type: "Functional", year: 2011},
  %{name: "Rust", popularity: 92, type: "Systems", year: 2010},
  %{name: "Go", popularity: 88, type: "Systems", year: 2009},
  %{name: "TypeScript", popularity: 95, type: "Scripting", year: 2012},
  %{name: "Kotlin", popularity: 78, type: "JVM", year: 2011},
  %{name: "Swift", popularity: 82, type: "Mobile", year: 2014}
]

Displaying Interactive Tables with Kino

Kino can render data as beautiful interactive tables:

Kino.DataTable.new(languages)
NameYearTypePopularity
Elixir2011Functional85
Rust2010Systems92
Go2009Systems88
TypeScript2012Scripting95
Kotlin2011JVM78
Swift2014Mobile82

Data Processing and Analysis

Using the Enum module for data filtering and transformation:

# Filter languages released after 2010 with popularity > 80
languages
|> Enum.filter(fn lang -> lang.year >= 2010and lang.popularity > 80end)
|> Enum.map(fn lang -> "#{lang.name} (#{lang.year})"end)
["Elixir (2011)", "Rust (2010)", "TypeScript (2012)", "Swift (2014)"]
# Calculate average popularity
avg_popularity = 
  languages
  |> Enum.map(& &1.popularity)
  |> Enum.sum()
  |> Kernel./(length(languages))
  |> Float.round(1)

"Average popularity: #{avg_popularity}"
"Average popularity: 86.7"

Data Visualization

Creating charts with VegaLite:

alias VegaLite, as: Vl

Vl.new(width:500, height:300, title:"Programming Language Popularity")
|> Vl.data_from_values(languages)
|> Vl.mark(:bar)
|> Vl.encode_field(:x, "name", type::nominal, title:"Language")
|> Vl.encode_field(:y, "popularity", type::quantitative, title:"Popularity")
|> Vl.encode_field(:color, "type", type::nominal)
Programming Language Popularity100500ElixirRustGoTSKotlinSwift

Summary

In this Livebook document, we learned:

  • How to create and process Elixir data structures
  • Using the Enum module for data filtering and transformation
  • Using Kino to display interactive tables
  • Using VegaLite to create data visualizations

Next steps: Try modifying the code, adding more data, or creating different types of charts!