Code Monkey home page Code Monkey logo

tucan's Introduction

Tucan

Actions Status Hex.pm hex.pm hex.pm Documentation github.com

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.

Tucan offers a simple API for creating most common plot types similarly to matplotlib and seaborn without requiring the end user to be familiar with the Vega Lite grammar.

Tucan

Features

  • Versatile Plot Types - Tucan provides an array of plot types, including bar charts, line plots, scatter plots, histograms, and more, allowing you to effectively represent diverse data sets.
  • Clean and consistent API - A clean and consistent plotting API similar to matplotlib or seaborn is provided. You should be able to create most common plots with a single function call and minimal configuration.
  • Grouping and Faceting - Enhance your visualizations with grouping and faceting features, enabling you to examine patterns and trends within subgroups of your data.
  • Customization - Customize your plots with ease using Tucan's utilities for adjusting plot dimensions, titles, and themes.
  • Thin wrapper on top of VegaLite - All VegaLite functions can be used seamlessly with Tucan in order to enhance/customize your plots.
  • Nx support - You can pass directly Nx tensors in all plot functions.
  • Low level API - A low level API with helper functions is provided for modifying VegaLite specifications.

Basic usage

# A simple scatter plot
Tucan.scatter(:iris, "petal_width", "petal_length")

# You can combine it with one or more semantic grouping functions
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.color_by("species")
|> Tucan.shape_by("species")

# You can pipe it through other Tucan functions to modify the look & feel
Tucan.bubble(:gapminder, "income", "health", "population",
  color_by: "region",
  tooltip: true
)
|> Tucan.set_width(400)
|> Tucan.Axes.set_x_title("Gdp per Capita")
|> Tucan.Axes.set_y_title("Life expectancy")
|> Tucan.Scale.set_x_scale(:log)

# Some composite plots are also supported
fields = ["petal_width", "petal_length", "sepal_width", "sepal_length"]

Tucan.pairplot(:iris, , width: 130, height: 130)
|> Tucan.color_by("species", recursive: true)

# creating facet plots is very easy with the facet_by/4 function
Tucan.scatter(:iris, "petal_width", "petal_length")
|> Tucan.facet_by(:column, "species")
|> Tucan.color_by("species")

Read the docs for more examples.

Installation

Inside Livebook

You most likely want to use Tucan in Livebook, in which case you can call Mix.install/2:

Mix.install([
  {:tucan, "~> 0.3.0"},
  {:kino_vega_lite, "~> 0.1.8"}
])

You will also want kino_vega_lite to ensure Livebook renders the graphics nicely.

In Mix projects

You can add the :tucan dependency to your mix.exs:

def deps do
  [
    {:tucan, "~> 0.3.0"}
  ]
end

NOTE: While I will try to maintain backwards compatibility as much as possible, since this is still a 0.x.x project the API is not considered stable and thus subject to possible breaking changes up until v1.0.0.

Acknowledgements

  • vega-lite and the awesome docs of it, many examples and most of the datasets used are based on it.
  • The elixir VegaLite bindings
  • seaborn, matplotlib and ggplot2 upon which the high level API is partially based.
  • vega-themes from which the existing themes are ported.

License

Copyright (c) 2023 Panagiotis Nezis

Tucan is released under the MIT License. See the LICENSE file for more details.

tucan's People

Contributors

kianmeng avatar pnezis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kianmeng

tucan's Issues

Add more vega lite themes

Add more themes and document the default themes. Move themes in exs files in the priv folder and auto-load them

Marginal distribution support

Add a function for adding marginal distribution plots to any graph with quantitative channels. The user should be able to select the type of the distribution plot.

Polar Plot

Are polar plots something that would be welcome here?
I have this PR open on VegaLite, but with the presence of this higher level library, it might be welcome here instead.

The only thing I'm not sure about is that the higher level API might not support the current structuring of the code.

3D plots support

Are there any 3D plots available like 3D scatter plots or planned to be implemented? I need one for a visualisation in Scholar.

Plots to be included in the first version

The following plots should be included in the first version:

Single view plots

Check the items once the plots are fully implemented and documented

  • line
  • barchart
  • countplot
  • scatter
  • bubble
  • histogram
  • heatmap
  • density
  • stripplot
  • area
  • pie
  • donut
  • boxplot

Composite plots

  • pairplot

Add vline, hline

Add helper functions for adding vertical and horizontal lines

Add a proper README

Include

  • installation (both mix.exs and livebook)
  • sample code
  • acknowledgements

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.