Created
April 20, 2009 14:36
-
-
Save liebke/98560 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
(use '(incanter core charts io)) | |
;; create points to plot | |
(def x1 (range 0.1 5 0.1)) | |
;; highlight a couple different sets of critical points | |
(def crit-pts1 [0.5 2 3]) | |
(def crit-pts2 [0.25 2.5 3.5]) | |
;; define a reciprocal function | |
(defn reciprocal [x] (div 1 x)) | |
;; create a xy-plot using :title :series-label, and :legend options | |
;; you can also set the labels of the x and y axes using :x-label and :y-label options | |
(doto (xy-plot x1 (reciprocal x1) | |
:title "New Title" | |
:series-label "1/x" | |
:legend true) | |
view | |
(add-points crit-pts1 (reciprocal crit-pts1) :series-label "critical pts 1") | |
(add-points crit-pts2 (reciprocal crit-pts2) :series-label "critical pts 2") | |
clear-background | |
(set-x-label "x") | |
(set-y-label "y") | |
(save "/tmp/sample_plot.png")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment