-
-
Save liebke/2f99f799e11c98a33ec9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The following examples require Incanter version 1.2.2-SNAPSHOT or greater. | |
;; add the following dependency to your project.clj file: | |
;; [incanter "1.2.2-SNAPSHOT"] | |
(use '(incanter core stats charts latex)) | |
;; define the latex formatted equation. | |
;; use the str function so you can break the equation across multiple lines. | |
(def eq (str "f(x)=\\frac{1}{\\sqrt{2\\pi \\sigma^2}}" | |
"e^{\\frac{-(x - \\mu)^2}{2 \\sigma^2}}")) | |
;; the rendered equation can be viewed or saved as a png file. | |
(view (latex eq)) | |
(save (latex eq) filename) | |
;; annotate a chart of the Normal PDF with the its equation in LaTeX | |
(doto (function-plot pdf-normal -3 3) | |
(add-latex 0 0.1 eq) | |
view) | |
;; add a LaTeX subtitle to the chart of the Normal PDF | |
(doto (function-plot pdf-normal -3 3) | |
(add-latex-subtitle eq) | |
view) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment