Skip to content

Commit

Permalink
updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
daslu committed Jul 27, 2024
1 parent 9e63009 commit 57d8114
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions notebooks/index.clj
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@

;; Kind-pyplot is a small Clojure library for visualizing Python plots. It uses the [Kindly](https://scicloj.github.io/kindly/) convention, and will thus work in Kindly-compatible tools such as [Clay](https://scicloj.github.io/clay/).

;; The implementation is inspired by the [Parens for Pyplot](https://gigasquidsoftware.com/blog/2020/01/18/parens-for-pyplot/) tutorial by Carin Meier from Jan 2020.

;; ## Setup

(ns index
(:require [libpython-clj2.require :refer [require-python]]
[libpython-clj2.python :refer [py. py.. py.-] :as py]
[scicloj.kind-pyplot.v1.api :as pyplot]))
(:require [scicloj.kind-pyplot.v1.api :as pyplot]))

;; From the Parens for Pyplot blogpost:

(require-python '[numpy :as np])
;; ## API

;; The `with-pyplot` macro takes Clojure forms that create a plot.
;; It evaluates them, and returns a showable (SVG) plot. For example:

(pyplot/with-pyplot
(matplotlib.pyplot/plot
[1 2 3 4 5 6]
[1 4 9 16 25 36]))

;; The `pyplot` function takes a Clojure function that creates a plot.
;; It calls the function, and returns a showable (SVG) plot. For example:

(pyplot/pyplot
#(matplotlib.pyplot/plot
[1 2 3 4 5 6]
[1 4 9 16 25 36]))

;; ## More examples

(require '[clojure.math :as math])
;; ## From the [Parens for Pyplot tutorial](https://gigasquidsoftware.com/blog/2020/01/18/parens-for-pyplot/)

(require '[libpython-clj2.require :refer [require-python]]
'[clojure.math :as math])
(require-python '[numpy :as np])

(def sine-data
(let [x (range 0 (* 3 np/pi) 0.1)]
Expand All @@ -24,7 +50,7 @@
(:x sine-data)
(:y sine-data)))

;; From the [Seaborn intro](https://seaborn.pydata.org/tutorial/introduction):
;; ## From the [Seaborn intro](https://seaborn.pydata.org/tutorial/introduction):

(require-python '[seaborn :as sns])

Expand Down

0 comments on commit 57d8114

Please sign in to comment.