plotje/notebooks at main · scicloj/plotje · GitHub
Skip to content

Latest commit

 

History

History

notebooks

Folders and files

;; # Plotje
;; Composable plotting in Clojure

^:kindly/hide-code
(ns readme
  (:require [scicloj.plotje.api :as pj]
            [scicloj.metamorph.ml.rdatasets :as rdatasets]))

^:kindly/hide-code
(-> (rdatasets/datasets-iris)
    (pj/pose :sepal-length :sepal-width {:color :species})
    pj/lay-point
    (pj/lay-smooth {:stat :linear-model})
    (pj/options {:width 700 :height 420}))

;; ---------------------

;; Plotje is a Clojure library for composable plotting, inspired by
;; the Grammar of Graphics.
;;
;; ## General information
;;
;; |||
;; |-|-|
;; |Website | [https://scicloj.github.io/plotje/](https://scicloj.github.io/plotje/)
;; |Source |[![(GitHub repo)](https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white)](https://github.com/scicloj/plotje)|
;; |Deps |[![Clojars Project](https://img.shields.io/clojars/v/org.scicloj/plotje.svg)](https://clojars.org/org.scicloj/plotje)|
;; |License |[MIT](https://github.com/scicloj/plotje/blob/main/LICENSE)|
;; |Status |🛠alpha🛠|
;;
;; ## Usage
;;
;; Plotje is intended to be used with data-visualization tools
;; that support the [Kindly](https://scicloj.github.io/kindly) convention
;; such as [Clay](https://scicloj.github.io/clay/).
;;
;; ## Quick example
;;
;; Line chart with point markers from plain Clojure data:

(-> [{:month "Jan" :sales 120}
     {:month "Feb" :sales 95}
     {:month "Mar" :sales 140}
     {:month "Apr" :sales 175}
     {:month "May" :sales 160}
     {:month "Jun" :sales 210}]
    (pj/lay-line :month :sales)
    pj/lay-point
    (pj/options {:title "Monthly Sales"}))

;; Scatter plot matrix (SPLOM) -- all pairwise combinations with color grouping:

(-> (rdatasets/datasets-iris)
    (pj/facet-matrix [:sepal-length :sepal-width
                      :petal-length :petal-width]
                     {:color :species})
    (pj/options {:title "Iris SPLOM"}))

;; ## License
;;
;; Copyright (c) 2025-2026 Scicloj
;;
;; Distributed under the MIT License.