pnezis

pnezis

Tucan - a plotting library on top of VegaLite

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.

Most Liked

pnezis

pnezis

New version released today: v0.2.0, with many new features:

  • heatmap, punchcard and jointplot plots
  • vruler and hruler for adding vertical/horizontal rulers on any plot
  • Helper modules for configuring the Legend and the Scale
  • Docs improvements, added a livebook guide

You can find the full CHANGELOG here

Any feedback welcome

josevalim

josevalim

Creator of Elixir

The new (and old) plots are great!

pnezis

pnezis

:tada: v0.3.0 is out. It includes many new features and enhancements:

  • Nx support, you can pass directly tensors as series to all plots
  • imshow allows you to plot pseudo-color images
  • errorbar and errorband plots added
  • lollipop plot added as an alternative to bar chart
  • Tucan.Geometry module provides an API for plotting common geometric shapes and polylines

You can find the full CHANGELOG here

Happy new year!

Where Next?

Popular in Announcing Top

sasajuric
I’d like to announce a small library called boundaries. This is an experimental project which explores the idea of enforcing boundaries ...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19483 141
New
bradley
I’ve been working with Claude Code extensively and absolutely love it. However, I’ve come across the challenge of managing configuration ...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New
blatyo
The best overview for how things are tied together is this presentation. Modules and functions are pretty well documented at this point, ...
New
nikokozak
Hello all, I’ve been working on Svonix - a library for quickly integrating Svelte components into Phoenix views. It’s a much-needed succ...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
cjen07
parameterized pipe in elixir: |n> edit: negative index in |n> and mixed usage with |> are supported example: use ParamPipe ...
New
Jskalc
Hi! Today, after a couple weeks of development I’ve released v0.1 of LiveVue. It’s a seamless integration of Vue and Phoenix LiveView, i...
New
marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New

Other popular topics Top

axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 48475 226
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54250 245
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

We're in Beta

About us Mission Statement