Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: smithzvk/ZGnuPlot
base: b182b074c7
...
head fork: smithzvk/ZGnuPlot
compare: fc3d934791
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
Commits on Oct 26, 2012
Zach Kost-Smith Bug fix: Correctly load hu.dwim.defclass-star.
I was loading a local (older) version.
32bd76b
Zach Kost-Smith Bug fix: including some of the utility functions that I was using fro…
…m Toolbox.

These were previously not present and the library was technically broken when I
removed the toolbox dependency.  I'm guessing that due to some stale fasl files,
the library seemed to work without actually including them.
79b3b93
Zach Kost-Smith Fixed up the test file which really doesn't contain proper tests yet.
fc3d934
Showing with 69 additions and 12 deletions.
  1. +1 −1  package.lisp
  2. +22 −6 test.lisp
  3. +42 −0 utils.lisp
  4. +4 −5 zgnuplot.asd
View
2  package.lisp
@@ -1,6 +1,6 @@
(defpackage :zgnuplot
- (:use :cl :defclass* :iter :modf :ima :ppcre)
+ (:use :cl :hu.dwim.defclass-star :iter :modf :ima :ppcre)
(:nicknames :zgp)
(:export #:gnuplot-setup
#:make-gnuplot-setup
View
28 test.lisp
@@ -13,6 +13,11 @@
(determine-range-dimensionality 'sin)
(determine-range-dimensionality (lambda (x y) (vector x y x)))
(determine-range-dimensionality (lambda (x y) (ima:append-imas (list (vector x y x) (vector x y x)) 0)))
+
+;; (combine-sniffs (make-gnuplot-setup :plot-type :3D) (make-gnuplot-setup :plot-type :2D))
+
+
+
;; @\section{2D Plots}
;; @\subsection{Curves}
@@ -89,22 +94,22 @@
:y-range '(0 1.1) :theta-range (list 0 pi))
(make-instance 'func-rep
:func (lambda (theta) (expt (sin theta) 1/16))
- :rep-label (tb:format-ext nil "(sin(x))^(1/16)"))
+ :rep-label (format-ext nil "(sin(x))^(1/16)"))
(make-instance 'func-rep
:func (lambda (theta) (expt (sin theta) 1/4))
- :rep-label (tb:format-ext nil "(sin(x))^(1/4)"))
+ :rep-label (format-ext nil "(sin(x))^(1/4)"))
(make-instance 'func-rep
:func (lambda (theta) (expt (sin theta) 1/2))
- :rep-label (tb:format-ext nil "sqrt(sin(x))"))
+ :rep-label (format-ext nil "sqrt(sin(x))"))
(make-instance 'func-rep
:func (lambda (theta) (sin theta))
- :rep-label (tb:format-ext nil "sin(x)"))
+ :rep-label (format-ext nil "sin(x)"))
(make-instance 'func-rep
:func (lambda (theta) (expt (sin theta) 2))
- :rep-label (tb:format-ext nil "sin²(x)"))
+ :rep-label (format-ext nil "sin²(x)"))
(make-instance 'func-rep
:func (lambda (theta) (expt (sin theta) 4))
- :rep-label (tb:format-ext nil "sin⁴(x)")))
+ :rep-label (format-ext nil "sin⁴(x)")))
;; @\subsection{Maps}
@@ -112,6 +117,15 @@
;; @\subsection{Surface Plots}
+;; The proper wap to make a standard surface plot:
+
+;; Banded surface plots like YongXiang was making. This color scheme is banded
+;; and corresponds to the tic marks on the $z$-axis. This is actually very nice
+;; from a readability standpoint as well as an aesthetical one.
+
+;; At the very least there had better be lines on the surface (contours), else
+;; why bother?
+
;; @\section{Showing Off}
;; @Here we include a series of plots that are for the sole purpose of showing
@@ -125,3 +139,5 @@
;; fractals? strange attractors?
+;; Hex-Density plots
+;; http://www.chrisstucchio.com/blog/2012/dont_use_scatterplots.html
View
42 utils.lisp
@@ -6,6 +6,48 @@
(setf (cdr (last circular-list)) circular-list)
circular-list))
+(defun format-ext (str control-string &rest args)
+ "Just like format, except convert certain elements in the arg list into forms
+more readable by other programs. For instance, print all number types in the
+1e0 format \(i.e. no fractions or 1d0s), and print pathnames as namestrings.
+
+Format has all sorts of nooks and crannies, so I bet that this facility can be
+broken without too much effort."
+ (let ((*read-default-float-format* 'long-float))
+ (apply #'format str control-string
+ (labels
+ ((convert-to-external (tree)
+ (cond ((null tree) nil)
+ ((atom tree)
+ (typecase tree
+ (integer tree)
+ (number (float tree 0L0))
+ (pathname (namestring tree))
+ (t tree)))
+ ((consp tree)
+ (mapcar #'convert-to-external tree)))))
+ (convert-to-external args)))))
+
+;;; Symbol/string utilities
+
+(defun mkstr (&rest args)
+ "MaKe STRing"
+ (with-output-to-string (s)
+ (dolist (a args) (princ a s))))
+
+(defun mkdstr (&rest args)
+ "MaKe space Delimited STRing"
+ (apply #'mkdstr* " " args))
+
+(defun mkdstr* (delimiter &rest args)
+ "MaKe arbitrarily Delimited STRing"
+ (let ((new-args
+ (and args (shuffle args (make-list (1- (length args))
+ :initial-element delimiter)))))
+ (with-output-to-string (s)
+ (dolist (a new-args)
+ (princ a s)))))
+
;;; PPCRE extensions
(defun reg-scan-to-string (regex target-string &key (start 0) (end (length target-string)))
(multiple-value-bind (matches registers) (ppcre:scan-to-strings regex target-string :start start :end end)
View
9 zgnuplot.asd
@@ -2,11 +2,10 @@
(asdf:defsystem :zgnuplot
:author "Zach Smith"
:license "GPLv3 or later. See file COPYING"
- :depends-on (:cffi :defclass-star
- :cl-ppcre
- :index-mapped-arrays
- :iterate :alexandria
- :osicat :modf)
+ :depends-on (:cffi :hu.dwim.defclass-star
+ :cl-ppcre :index-mapped-arrays
+ :iterate :alexandria
+ :osicat :modf)
:components ((:file "package")
(:file "utils")
(:file "plumbing")

No commit comments for this range

Something went wrong with that request. Please try again.