Napkinsketch

Simple and easy plotting

1 Preface

NapkinSketch is a Clojure library for composable plotting, inspired by the Grammar of Graphics.

General info

Website https://scicloj.github.io/napkinsketch/
Source (GitHub repo)
Deps Clojars Project
License MIT
Status πŸ› alphaπŸ› 

Usage

Add to your deps.edn:

org.scicloj/napkinsketch {:mvn/version "0.1.0"}

Napkinsketch is intended to be used with data-visualization tools that support the Kindly convention such as Clay.

Quick example

(ns readme
  (:require [tablecloth.api :as tc]
            [scicloj.napkinsketch.api :as sk]))

(def iris (tc/dataset "https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv"
                      {:key-fn keyword}))

Scatter plot with color grouping:

(-> iris
    ;; scatterplot layer: 
    (sk/lay-point :sepal_length :sepal_width {:color :species})
    ;; eager rendering (usually not needed):
    sk/plot)

Multiple layers β€” shared aesthetics via sk/view:

(-> iris
    ;; aesthetics shared across layers: 
    (sk/view :sepal_length :sepal_width {:color :species})
    ;; scatterplot layer: 
    sk/lay-point
    ;; linear model layer:
    sk/lay-lm
    ;; eager rendering (usually not needed):
    sk/plot)

Documentation

Full documentation

License

Copyright Β© 2025-2026 Scicloj

Distributed under the MIT License.

source: notebooks/index.clj