pnezis

pnezis

Tucan is an Elixir plotting library built on top of VegaLite designed to simplify the creation of interactive and visually stunning plots. With Tucan you can effortlessly generate a wide range of plots, from simple bar charts to complex composite plots, all while enjoying the power and flexibility of a clean composable functional API. Version 0.1.1 was just released :tada:

You can find the docs here.

Sample usage:

scatter =
  Tucan.scatter(:iris, "petal_width", "petal_length", tooltip: true)
  |> Tucan.color_by("species")
  |> Tucan.shape_by("species")

lines = Tucan.lineplot(:stocks, "date", "price", color_by: "symbol", x: [type: :temporal])

area =
  Tucan.area(:stocks, "date", "price", color_by: "symbol", mode: :normalize, x: [type: :temporal])

density = Tucan.density(:penguins, "Body Mass (g)", color_by: "Species", fill_opacity: 0.2)

strip =
  Tucan.stripplot(:tips, "total_bill", group: "day", style: :jitter)
  |> Tucan.color_by("sex")

boxplot = Tucan.boxplot(:penguins, "Body Mass (g)", color_by: "Species")
histogram = Tucan.histogram(:cars, "Horsepower", color_by: "Origin", fill_opacity: 0.5)

pie = Tucan.pie(:barley, "yield", "site", aggregate: :sum, tooltip: true)

donut = Tucan.donut(:barley, "yield", "site", aggregate: :sum, tooltip: true)

heatmap =
  Tucan.density_heatmap(:penguins, "Beak Length (mm)", "Beak Depth (mm)", fill_opacity: 1.0)

Tucan.vconcat([
  Tucan.hconcat([scatter, lines, area]),
  Tucan.hconcat([density, Tucan.vconcat([strip, boxplot]), histogram]),
  Tucan.hconcat([pie, donut, heatmap])
])

will generate the following:

Credits go to @jonatanklosko for the awesome VegaLite bindings.

Showing Posts 1 to 10

billylanchantin

billylanchantin

Hey this is looks great!

I’ve been playing with VegaLite recently. I have a Matplotlib background and I think because of that I found the new API a little confusing. I’ll give this a try!

pnezis

pnezis OP

Hey @billylanchantin that was the main reason i implemented it. I have also a seaborn/matplotlib background and the learning curve of VegaLite was steep.

jonatanklosko

jonatanklosko

Creator of Livebook

@pnezis this is amazing and charts in the docs are absolute fire!! :cat2: :fire:

josevalim

josevalim

Creator of Elixir

Amazing! :fire:

mat-hek

mat-hek

Membrane Core Team

Very cool! Any plans for live/dynamically updated charts? It’s the part of VegaLite that made me struggle the most.

pnezis

pnezis OP

@jonatanklosko thanks!

The charts are auto-generated from plain markdown code blocks. A custom markdown processor is used that compiles the block, formats it and renders both the original code block and the vega lite spec.

The underlying package originated from a discussion with @josevalim in the ex_doc repo some time ago.

pnezis

pnezis OP

Hi! dynamically updated charts as well as a high level API for interactive charts is in the plans for future releases.

josevalim

josevalim

Creator of Elixir

@pnezis would you also support heatmaps? My understanding is that they are similar to your current density heatmap, except there is no binning on X and no aggregate on Y. :slight_smile: (X may also need to be nominal).

pnezis

pnezis OP

@josevalim correct heatmaps are very similar to denisty heatmaps, but for categorical variables on both axes (ordinal or nominal in vegalite terminology) instead of numerical.

I guess I missed it, will definitely add it.

pnezis

pnezis OP

@josevalim heatmap/5 added :slight_smile: Will release a new version later this week

Where Next? Top

Trending in Announcing Top

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews