From 8095c1696239f4e97b06f297335259449547d330 Mon Sep 17 00:00:00 2001 From: Joshua Kordani Date: Mon, 31 Jan 2022 21:43:17 -0500 Subject: [PATCH 1/2] MacOS uiop:launch-program requires '("command" "arg1" "arg2" ... "argn") --- plot.lisp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plot.lisp b/plot.lisp index 6f16869..d55659e 100644 --- a/plot.lisp +++ b/plot.lisp @@ -6,11 +6,12 @@ "Open plot specification FILESPEC" (let ((plot-file (namestring (truename filespec)))) #+windows (setf plot-file (concatenate 'string "file:///" plot-file)) - (uiop:launch-program `(,(alexandria:assoc-value plot:*browser-commands* browser) - ,(case browser - (:chrome (if (assoc "app" browser-options :test 'string=) - (setf (cdr (assoc "app" browser-options :test 'string=)) plot-file)) - (encode-chrome-options browser-options)) - (:default plot-file))) + #+(or macos darwin linux) (setf plot-file (concatenate 'string "file://" plot-file)) + (uiop:launch-program (append (list (alexandria:assoc-value plot:*browser-commands* browser)) + (cl-ppcre:split "\\s+" (case browser + (:chrome (if (assoc "app" browser-options :test 'string=) + (setf (cdr (assoc "app" browser-options :test 'string=)) plot-file)) + (encode-chrome-options browser-options)) + (:default plot-file)))) :ignore-error-status t))) From 010959f9946db8c7ba3e59521fb040813e8c3678 Mon Sep 17 00:00:00 2001 From: Joshua Kordani Date: Mon, 31 Jan 2022 21:44:00 -0500 Subject: [PATCH 2/2] histogram plot now supports accepting column names as a symbol, and if provided as a string instead, upcases in order to match the column name in the final output --- src/vglt/spec.lisp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/vglt/spec.lisp b/src/vglt/spec.lisp index ef1ec07..e00dc59 100644 --- a/src/vglt/spec.lisp +++ b/src/vglt/spec.lisp @@ -73,7 +73,8 @@ ;;(defun histogram (data &key (column nil) (title nil) (description nil)) (defun histogram (data column &key (title nil) (description nil)) "Return a Vega-Lite JSON specification for a histogram plot" - (assert (or (and (typep data 'df:data-frame) column) + (assert (or (and (typep data 'df:data-frame) (or (typep column 'symbol) + (typep column 'string))) (typep data 'sequence)) () "If using a DATA-FRAME, a column must be given") @@ -86,7 +87,10 @@ (t (setf spec (acons "data" data spec)))) (setf spec (acons "mark" "bar" spec)) (etypecase data - (df:data-frame (setf spec (acons "encoding" `(("x" ("field" . ,column) ("bin" . t)) + (df:data-frame (setf spec (acons "encoding" `(("x" ("field" . ,(if (typep column 'string) + (string-upcase column) + (symbol-name column))) + ("bin" . t)) ("y" ("aggregate" . "count"))) spec))) (sequence (setf spec (acons "encoding" `(("x" ("field" . "X") ("bin" . t))