From: Jaime E. V. <vi...@us...> - 2013-12-19 16:26:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Maxima CAS". The branch, master has been updated via 0ccd41f22f26400abc7569da4b492e90e234d8b8 (commit) from 77b82b869712f00b0fd691eb0c25d00f8a396250 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0ccd41f22f26400abc7569da4b492e90e234d8b8 Author: Jaime Villate <vi...@fe...> Date: Thu Dec 19 16:21:19 2013 +0000 Fixes names of plot options and adds some new ones Names of the new plot options and funcitons now follow the convention of spelled out words, separated by underscores, unless a word has just one letter: remove_plot_option(name), gnuplot_postamble, color_bar_tics, grid2d, iterations, label, same_xy, same_xyz, title, xbounds, xvar, xtics, xy_scale, ybounds, ytics, yx_ratio, ytics, yvar, zmin, ztics and ps_file New options added to save output in SVG, PNG or PDF formats: png_file, pdf_file, svg_file, gnuplot_png_term_command, gnuplot_pdf_term_command and gnuplot_svg_term_command diff --git a/share/dynamics/complex_dynamics.lisp b/share/dynamics/complex_dynamics.lisp index b2ca1cb..89abbc3 100644 --- a/share/dynamics/complex_dynamics.lisp +++ b/share/dynamics/complex_dynamics.lisp @@ -32,7 +32,7 @@ (unless (getf options :iterations) (setf (getf options :iterations) 9)) (unless (getf options :xlabel) (setf (getf options :xlabel) "x")) (unless (getf options :ylabel) (setf (getf options :ylabel) "y")) - (unless (member :colorbox options) (setf (getf options :colorbox) t)) + (unless (member :color_bar options) (setf (getf options :color_bar) t)) (setf (getf options :palette) '(((mlist) $gradient $magenta $violet $blue $cyan $green $yellow $orange $red $brown $black))) @@ -40,7 +40,7 @@ ;; Parses the options given in the command line (setq options (plot-options-parser extra-options options)) (setf file-name (plot-temp-file "maxout.gnuplot")) - (unless (getf options :yxratio) (setf (getf options :samexy) t)) + (unless (getf options :yx_ratio) (setf (getf options :same_xy) t)) (setq xmin (car (getf options :x))) (setq xmax (cadr (getf options :x))) @@ -91,7 +91,7 @@ (unless (getf options :iterations) (setf (getf options :iterations) 9)) (unless (getf options :xlabel) (setf (getf options :xlabel) "x")) (unless (getf options :ylabel) (setf (getf options :ylabel) "y")) - (unless (member :colorbox options) (setf (getf options :colorbox) t)) + (unless (member :color_bar options) (setf (getf options :color_bar) t)) (setf (getf options :palette) '(((mlist) $gradient $magenta $violet $blue $cyan $green $yellow $orange $red $brown $black))) @@ -99,7 +99,7 @@ ;; Parses the options given in the command line (setq options (plot-options-parser extra-options options)) (setf file-name (plot-temp-file "maxout.gnuplot")) - (unless (getf options :yxratio) (setf (getf options :samexy) t)) + (unless (getf options :yx_ratio) (setf (getf options :same_xy) t)) (setq xmin (car (getf options :x))) (setq xmax (cadr (getf options :x))) diff --git a/src/gnuplot_def.lisp b/src/gnuplot_def.lisp index dad80ee..f11e4fc 100644 --- a/src/gnuplot_def.lisp +++ b/src/gnuplot_def.lisp @@ -228,47 +228,53 @@ (first palette))))))) (defun gnuplot-print-header (dest plot-options) - (let ((gnuplot-out-file (getf plot-options :gnuplot_out_file)) - (preamble (getf plot-options :gnuplot_preamble)) - (palette (getf plot-options :palette)) + (let (terminal-file (palette (getf plot-options :palette)) (meshcolor (if (member :mesh_lines_color plot-options) (getf plot-options :mesh_lines_color) '$black))) (when (find 'mlist palette :key #'car) (setq palette (list palette))) - ;; user's prefix commands - (when (getf plot-options :gnuplot_prefix) - (format dest "~a~%" (getf plot-options :gnuplot_prefix))) - ;; user's preamble - (if (and preamble (> (length preamble) 0)) - (format dest "~a~%" preamble) - (progn - (when (string= (getf plot-options :type) "plot3d") - (format dest "set xyplane relative 0~%") - (if palette + ;; user's preamble + (when (and (getf plot-options :gnuplot_preamble) + (> (length (getf plot-options :gnuplot_preamble)) 0)) + (format dest "~a~%" (getf plot-options :gnuplot_preamble))) + + ;; sets-up terminal command and output file name + (setq terminal-file (gnuplot-terminal-and-file plot-options)) + + ;; prints terminal and output commands + (when (first terminal-file) + (format dest "~a~%" (first terminal-file))) + (when (second terminal-file) + (format dest "set output ~s~%" (second terminal-file))) + + ;; options specific to plot3d + (when (string= (getf plot-options :type) "plot3d") + (format dest "set xyplane relative 0~%") + (if palette + (progn + (if meshcolor (progn - (if meshcolor - (progn - (format dest "set style line 100 lt rgb ~s lw 1~%" - (rgb-color meshcolor)) - (format dest "set pm3d hidden3d 100~%") - (unless (getf plot-options :gnuplot_4_0) - (format dest "set pm3d depthorder~%"))) - (format dest "set pm3d~%")) - (format dest "unset hidden3d~%") - (format dest "set palette ~a~%" - (gnuplot-palette (rest (first palette))))) - (format dest "set hidden3d~%")) - (let ((elev (getf plot-options :elevation)) - (azim (getf plot-options :azimuth))) - (when (or elev azim) - (if elev - (format dest "set view ~d" elev) - (format dest "set view ")) - (when azim (format dest ", ~d" azim)) - (format dest "~%")))))) - - ;; colorbox can be used by plot3d or plot2d - (unless (getf plot-options :colorbox) + (format dest "set style line 100 lt rgb ~s lw 1~%" + (rgb-color meshcolor)) + (format dest "set pm3d hidden3d 100~%") + (unless (getf plot-options :gnuplot_4_0) + (format dest "set pm3d depthorder~%"))) + (format dest "set pm3d~%")) + (format dest "unset hidden3d~%") + (format dest "set palette ~a~%" + (gnuplot-palette (rest (first palette))))) + (format dest "set hidden3d~%")) + (let ((elev (getf plot-options :elevation)) + (azim (getf plot-options :azimuth))) + (when (or elev azim) + (if elev + (format dest "set view ~d" elev) + (format dest "set view ")) + (when azim (format dest ", ~d" azim)) + (format dest "~%")))) + + ;; color_bar can be used by plot3d or plot2d + (unless (getf plot-options :color_bar) (format dest "unset colorbox~%")) ;; ----- BEGIN GNUPLOT 4.0 WORK-AROUND ----- @@ -287,38 +293,6 @@ (1+ (getf plot-options :const_expr)))) ;; ----- END GNUPLOT 4.0 WORK-AROUND ----- - ;; default output file name for all formats except default - (when (not (eq (getf plot-options :gnuplot_term) '$default)) - (cond ((null gnuplot-out-file) - (setq gnuplot-out-file - (plot-temp-file - (format nil "maxplot.~(~a~)" - (get-gnuplot-term - (getf plot-options :gnuplot_term)))))) - ((not (search "/" gnuplot-out-file)) - (setq gnuplot-out-file (plot-temp-file gnuplot-out-file))))) - - ;; selects gnuplot terminal - (case (getf plot-options :gnuplot_term) - ($default - (format dest "set term wxt size 640,480; ~a~%" - (getf plot-options :gnuplot_default_term_command))) - ($ps - (format dest "~a~%" - (getf plot-options :gnuplot_ps_term_command)) - (if gnuplot-out-file - (format dest "set out ~s~%" gnuplot-out-file))) - ($dumb - (format dest "~a~%" - (getf plot-options :gnuplot_dumb_term_command)) - (if gnuplot-out-file - (format dest "set out ~s~%" gnuplot-out-file))) - (t - (format dest "set term ~a~%" - (ensure-string (getf plot-options :gnuplot_term))) - (if gnuplot-out-file - (format dest "set out ~s~%" gnuplot-out-file))) ) - ;; logarithmic plots (when (getf plot-options :logx) (format dest "set log x~%")) (when (getf plot-options :logy) (format dest "set log y~%")) @@ -351,20 +325,20 @@ (format dest "unset grid~%")) ;; plot size and aspect ratio for plot2d - (if (getf plot-options :samexy) + (if (getf plot-options :same_xy) (format dest "set size ratio -1~%") - (if (getf plot-options :yxratio) - (format dest "set size ratio ~f~%" (getf plot-options :yxratio)) + (if (getf plot-options :yx_ratio) + (format dest "set size ratio ~f~%" (getf plot-options :yx_ratio)) (format dest "set size ratio 0.75~%"))) - (if (and (getf plot-options :xyscale) - (listp (getf plot-options :xyscale))) - (format dest "set size ~{~f~^, ~}~%" (getf plot-options :xyscale)))) + (if (and (getf plot-options :xy_scale) + (listp (getf plot-options :xy_scale))) + (format dest "set size ~{~f~^, ~}~%" (getf plot-options :xy_scale)))) ;; plot size and aspect ratio for plot3d (when (string= (getf plot-options :type) "plot3d") - (when (getf plot-options :samexy) + (when (getf plot-options :same_xy) (format dest "set view equal xy~%")) - (when (getf plot-options :samexyz) + (when (getf plot-options :same_xyz) (format dest "set view equal xyz~%")) (when (getf plot-options :zmin) (format dest "set xyplane at ~f~%" (getf plot-options :zmin)))) @@ -391,8 +365,8 @@ (if ztics (format dest "set ztics ~f~%" ztics) (format dest "unset ztics~%"))))) - (when (member :cbtics plot-options) - (let ((cbtics (getf plot-options :cbtics))) + (when (member :color_bar_tics plot-options) + (let ((cbtics (getf plot-options :color_bar_tics))) (if (consp cbtics) (format dest "set cbtics ~{~f~^, ~}~%" cbtics) (if cbtics @@ -428,11 +402,12 @@ (format dest "set datafile missing ~s~%" *missing-data-indicator*) ;; user's commands; may overule any of the previous settings - (when (getf plot-options :gnuplot_suffix) - (format dest "~a~%" (getf plot-options :gnuplot_suffix))) + (when (and (getf plot-options :gnuplot_postamble) + (> (length (getf plot-options :gnuplot_postamble)) 0)) + (format dest "~a~%" (getf plot-options :gnuplot_postamble))) ;;returns the name of the file created - (or gnuplot-out-file ""))) + (or (second terminal-file) ""))) (defun gnuplot-plot3d-command (file palette gstyles colors titles n) (let (title (style "with pm3d")) @@ -450,4 +425,66 @@ (setq title "")) (format out "~s title ~s ~a" file title style))))) +(defun gnuplot-terminal-and-file (plot-options) +(let (terminal-command out-file) + (cond + ((getf plot-options :svg_file) + (if (getf plot-options :gnuplot_svg_term_command) + (setq terminal-command + (getf plot-options :gnuplot_svg_term_command)) + (setq terminal-command "set term svg font \",14\"")) + (setq out-file (getf plot-options :svg_file))) + ((getf plot-options :png_file) + (if (getf plot-options :gnuplot_png_term_command) + (setq terminal-command + (getf plot-options :gnuplot_png_term_command)) + (setq terminal-command "set term pngcairo font \",12\"")) + (setq out-file (getf plot-options :png_file))) + ((getf plot-options :pdf_file) + (if (getf plot-options :gnuplot_pdf_term_command) + (setq terminal-command + (getf plot-options :gnuplot_pdf_term_command)) + (setq terminal-command "set term pdfcairo color solid lw 3 size 17.2 cm, 12.9 cm font \",18\"")) + (setq out-file (getf plot-options :pdf_file))) + ((getf plot-options :ps_file) + (if (getf plot-options :gnuplot_ps_term_command) + (setq terminal-command + (getf plot-options :gnuplot_ps_term_command)) + (setq terminal-command "set term postscript eps color solid lw 2 size 16.4 cm, 12.3 cm font \",24\"")) + (setq out-file (getf plot-options :ps_file))) + ((eq (getf plot-options :gnuplot_term) '$ps) + (if (getf plot-options :gnuplot_ps_term_command) + (setq terminal-command + (getf plot-options :gnuplot_ps_term_command)) + (setq terminal-command "set size 1.3,1.3; set term postscript eps color solid lw 2.5 30")) + (if (getf plot-options :gnuplot_out_file) + (setq out-file (getf plot-options :gnuplot_out_file)) + (setq out-file "maxplot.ps"))) + ((eq (getf plot-options :gnuplot_term) '$dumb) + (if (getf plot-options :gnuplot_dumb_term_command) + (setq terminal-command + (getf plot-options :gnuplot_ps_term_command)) + (setq terminal-command "set term dumb 79 22")) + (if (getf plot-options :gnuplot_out_file) + (setq out-file (getf plot-options :gnuplot_out_file)) + (setq out-file "maxplot.txt"))) + ((eq (getf plot-options :gnuplot_term) '$default) + (if (getf plot-options :gnuplot_default_term_command) + (setq terminal-command + (getf plot-options :gnuplot_default_term_command)) + (setq terminal-command + "set term wxt size 640,480 font \",12\"; set term pop"))) + ((getf plot-options :gnuplot_term) + (setq terminal-command + (ensure-string (getf plot-options :gnuplot_term))) + (if (getf plot-options :gnuplot_out_file) + (setq out-file (getf plot-options :gnuplot_out_file)) + (setq + out-file + (format nil "maxplot.~(~a~)" + (get-gnuplot-term (getf plot-options :gnuplot_term))))))) + ;; If no file path is given, create file in the temporary directory + (when (and (not (null out-file)) (not (search "/" out-file))) + (setq out-file (plot-temp-file out-file))) + (list terminal-command out-file))) diff --git a/src/plot.lisp b/src/plot.lisp index d1935b1..68157e7 100644 --- a/src/plot.lisp +++ b/src/plot.lisp @@ -60,16 +60,11 @@ sin(y)*(10.0+6*cos(x)), ;; controls the number of splittings adaptive-plotting will do. :nticks 29 :adapt_depth 5 :color ($blue $red $green $magenta $black $cyan) - :point_type ($bullet $circle $plus $times $asterisk $box $square - $triangle $delta $wedge $nabla $diamond $lozenge) + :point_type ($bullet $box $triangle $plus $times $asterisk) :palette (((mlist) $gradient $green $cyan $blue $violet) ((mlist) $gradient $magenta $violet $blue $cyan $green $yellow $orange $red $brown $black)) - :gnuplot_preamble "" :gnuplot_term $default - :gnuplot_default_term_command "set term pop" - :gnuplot_dumb_term_command "set term dumb 79 22" - :gnuplot_ps_term_command - "set size 1.5, 1.5;set term postscript eps enhanced color solid 24")) + :gnuplot_preamble "" :gnuplot_term $default)) (defvar $plot_options `((mlist) @@ -223,23 +218,26 @@ sin(y)*(10.0+6*cos(x)), (setq *plot-options* (plot-options-parser value *plot-options*)) ($get_plot_option)) -(defun $rem_plot_option (name) +(defun $remove_plot_option (name) (remf *plot-options* (case name ($adapt_depth :adapt_depth) ($axes :axes) ($azimuth :azimuth) - ($box :box) ($cbtics :cbtics) ($color :color) ($colorbox :colorbox) - ($elevation :elevation) ($grid :grid) ($grid2d :grid2d) - ($iterations :iterations) ($label :label) ($legend :legend) - ($logx :logx) ($logy :logy) ($mesh_lines_color :mesh_lines_color) - ($nticks :nticks) ($palette :palette) ($plot_format :plot_format) + ($box :box) ($color :color) ($color_bar :color_bar) + ($color_bar_tics :color_bar_tics) ($elevation :elevation) + ($grid :grid) ($grid2d :grid2d) ($iterations :iterations) + ($label :label) ($legend :legend) ($logx :logx) ($logy :logy) + ($mesh_lines_color :mesh_lines_color) ($nticks :nticks) + ($palette :palette) ($plot_format :plot_format) ($plot_realpart :plot_realpart) ($point_type :point_type) - ($psfile :psfile) ($run_viewer :run_viewer) ($samexy :samexy) - ($samexyz :samexyz) ($style :style) ($t :t) ($title :title) - ($transform_xy :transform_xy) ($x :x) ($xbounds :xbounds) - ($xlabel :xlabel) ($xvar :xvar) ($xyratio :xyratio) - ($xyscale :xyscale) ($y :y) ($xtics :xtics) ($ybounds :ybounds) - ($ylabel :ylabel) ($ytics :ytics) ($yvar :yvar) ($z :z) - ($zlabel :zlabel) ($zmin :zmin) ($ztics :ztics) + ($pdf_file :pdf_file) ($png_file :png_file) ($ps_file :ps_file) + ($run_viewer :run_viewer) ($same_xy :samexy) + ($same_xyz :same_xyz) ($style :style) ($svg_file :svg_file) + ($t :t) ($title :title) ($transform_xy :transform_xy) + ($x :x) ($xbounds :xbounds) ($xlabel :xlabel) + ($xtics :xtics) ($xvar :xvar) ($xy_scale :xy_scale) + ($y :y) ($ybounds :ybounds) ($ylabel :ylabel) ($ytics :ytics) + ($yvar :yvar) ($yx_ratio :yx_ratio) + ($z :z) ($zlabel :zlabel) ($zmin :zmin) ($ztics :ztics) ($gnuplot_4_0 :gnuplot_4_0) ($gnuplot_curve_titles :gnuplot_curve_titles) ($gnuplot_curve_styles :gnuplot_curve_styles) @@ -248,9 +246,11 @@ sin(y)*(10.0+6*cos(x)), ($gnuplot_out_file :gnuplot_out_file) ($gnuplot_pm3d :gnuplot_pm3d) ($gnuplot_preamble :gnuplot_preamble) - ($gnuplot_prefix :gnuplot_prefix) + ($gnuplot_postamble :gnuplot_postamble) + ($gnuplot_pdf_term_command :gnuplot_pdf_term_command) + ($gnuplot_png_term_command :gnuplot_png_term_command) ($gnuplot_ps_term_command :gnuplot_ps_term_command) - ($gnuplot_suffix :gnuplot_suffix) + ($gnuplot_svg_term_command :gnuplot_svg_term_command) ($gnuplot_term :gnuplot_term)))) (defun get-gnuplot-term (term) @@ -1379,41 +1379,32 @@ sin(y)*(10.0+6*cos(x)), (format nil "~a/~a" *maxima-tempdir* file) file)) -(defun gnuplot-process (plot-options &optional file) +(defun gnuplot-process (plot-options &optional file out-file) (let ((gnuplot-term (getf plot-options :gnuplot_term)) - (gnuplot-out-file (getf plot-options :gnuplot_out_file)) - (gnuplot-out-file-string (getf plot-options :gnuplot_out_file)) (run-viewer (getf plot-options :run_viewer)) - (gnuplot-preamble (string-downcase (getf plot-options :gnuplot_preamble))) - (view-file)) - ;; default output file name for for all formats except default - (when (not (eq gnuplot-term '$default)) - (cond ((null gnuplot-out-file) - (setq gnuplot-out-file - (plot-temp-file (format nil "maxplot.~(~a~)" - (get-gnuplot-term gnuplot-term))))) - ((not (search "/" gnuplot-out-file)) - (setq gnuplot-out-file (plot-temp-file gnuplot-out-file)))) - (setq gnuplot-out-file-string gnuplot-out-file)) - - ;; run gnuplot in batch mode if necessary before viewing - (when (and gnuplot-out-file (not (eq gnuplot-term '$default))) + (gnuplot-preamble + (string-downcase (getf plot-options :gnuplot_preamble)))) + + ;; creates the output file, when there is one to be created + (when (and out-file (not (eq gnuplot-term '$default))) ($system (format nil "~a ~a" $gnuplot_command (format nil $gnuplot_file_args file)))) + + ;; displays contents of the output file, when gnuplot-term is dumb, + ;; or runs gnuplot when gnuplot-term is default (when run-viewer - (if (eq gnuplot-term '$default) - (setf view-file file) - (setf view-file gnuplot-out-file-string)) (case gnuplot-term ($default + ;; the options given to gnuplot will be different when the user + ;; redirects the output by using "set output" in the preamble ($system (format nil "~a ~a" $gnuplot_command - (format nil (if (search "set out " gnuplot-preamble) + (format nil (if (search "set out" gnuplot-preamble) $gnuplot_file_args $gnuplot_view_args) - view-file)))) + file)))) ($dumb - (if gnuplot-out-file - ($printfile view-file) + (if out-file + ($printfile out-file) (merror (intl:gettext "plotting: option 'gnuplot_out_file' not defined.")))))))) ;; plot-options-parser puts the plot options given into a property list. @@ -1435,7 +1426,7 @@ sin(y)*(10.0+6*cos(x)), "plot-options-parser: Expecting a symbol for the option name, found: \"~M\"") opt)) (case name ($adapt_depth - (setf (getf options :depth) + (setf (getf options :adapt_depth) (check-option (cdr opt) #'naturalp "a natural number" 1))) ($axes (setf (getf options :axes) (check-option-b (cdr opt) #'axesoptionp "x, y, solid" 1))) @@ -1445,11 +1436,11 @@ sin(y)*(10.0+6*cos(x)), (check-option (cdr opt) #'realp "a real number" 1))) ($box (setf (getf options :box) (check-option-boole (cdr opt)))) - ($cbtics (setf (getf options :cbtics) + ($color_bar_tics (setf (getf options :color_bar_tics) (check-option-b (cdr opt) #'realp "a real number" 3))) ($color (setf (getf options :color) (check-option (cdr opt) #'plotcolorp "a color"))) - ($colorbox (setf (getf options :colorbox) + ($color_bar (setf (getf options :color_bar) (check-option-boole (cdr opt)))) ($elevation (if (caddr opt) (setf (caddr opt) (parse-elevation (caddr opt)))) @@ -1483,16 +1474,22 @@ sin(y)*(10.0+6*cos(x)), (check-option-boole (cdr opt)))) ($point_type (setf (getf options :point_type) (check-option (cdr opt) #'pointtypep "a point type"))) - ($psfile (setf (getf options :psfile) + ($pdf_file (setf (getf options :pdf_file) + (check-option (cdr opt) #'stringp "a string" 1))) + ($png_file (setf (getf options :png_file) + (check-option (cdr opt) #'stringp "a string" 1))) + ($ps_file (setf (getf options :ps_file) (check-option (cdr opt) #'stringp "a string" 1))) ($run_viewer (setf (getf options :run_viewer) (check-option-boole (cdr opt)))) - ($samexy (setf (getf options :samexy) + ($same_xy (setf (getf options :same_xy) (check-option-boole (cdr opt)))) - ($samexyz (setf (getf options :samexyz) + ($same_xyz (setf (getf options :same_xyz) (check-option-boole (cdr opt)))) ($style (setf (getf options :style) (check-option-style (cdr opt)))) + ($svg_file (setf (getf options :svg_file) + (check-option (cdr opt) #'stringp "a string" 1))) ($t (setf (getf options :t) (cddr (check-range opt)))) ($title (setf (getf options :title) (check-option (cdr opt) #'stringp "a string" 1))) @@ -1506,7 +1503,7 @@ sin(y)*(10.0+6*cos(x)), (check-option-b (cdr opt) #'realp "a real number" 3))) ($xvar (setf (getf options :xvar) (check-option (cdr opt) #'string "a string" 1))) - ($xyscale (setf (getf options :xyscale) + ($xy_scale (setf (getf options :xy_scale) (check-option (cdr opt) #'realpositivep "a positive real number" 2))) ($y (setf (getf options :y) (cddr (check-range opt)))) @@ -1517,7 +1514,7 @@ sin(y)*(10.0+6*cos(x)), (check-option-b (cdr opt) #'realp "a real number" 3))) ($yvar (setf (getf options :yvar) (check-option (cdr opt) #'string "a string" 1))) - ($yxratio (setf (getf options :yxratio) + ($yx_ratio (setf (getf options :yx_ratio) (check-option (cdr opt) #'realp "a real number" 1))) ($z (setf (getf options :z) (cddr (check-range opt)))) @@ -1550,14 +1547,20 @@ sin(y)*(10.0+6*cos(x)), ($gnuplot_preamble (setf (getf options :gnuplot_preamble) (check-option (cdr opt) #'stringp "a string" 1))) - ($gnuplot_prefix - (setf (getf options :gnuplot_prefix) + ($gnuplot_postamble + (setf (getf options :gnuplot_postamble) + (check-option (cdr opt) #'stringp "a string" 1))) + ($gnuplot_pdf_term_command + (setf (getf options :gnuplot_pdf_term_command) + (check-option (cdr opt) #'stringp "a string" 1))) + ($gnuplot_png_term_command + (setf (getf options :gnuplot_png_term_command) (check-option (cdr opt) #'stringp "a string" 1))) ($gnuplot_ps_term_command (setf (getf options :gnuplot_ps_term_command) (check-option (cdr opt) #'stringp "a string" 1))) - ($gnuplot_suffix - (setf (getf options :gnuplot_suffix) + ($gnuplot_svg_term_command + (setf (getf options :gnuplot_svg_term_command) (check-option (cdr opt) #'stringp "a string" 1))) ;; gnuplot_term is a tricky one: when it is just default, dumb or ;; ps, we want it to be a symbol, but when it is more complicated, @@ -1575,6 +1578,14 @@ sin(y)*(10.0+6*cos(x)), (t (merror (intl:gettext "plot-options-parser: unknown plot option: ~M") opt)))) + + ;; plots that create a file work better in gnuplot than gnuplot_pipes + (when (and (eq (getf options :plot_format) '$gnuplot_pipes) + (or (eq (getf options :gnuplot_term) '$dumb) + (getf options :pdf_file) (getf options :png_file) + (getf options :ps_file) (getf options :svg_file))) + (setf (getf options :plot_format) '$gnuplot)) + options) ;; natural numbers predicate @@ -1836,7 +1847,7 @@ sin(y)*(10.0+6*cos(x)), ;; Parse the given options into the options list (setq options (plot-options-parser extra-options options)) - (when (getf options :y) (setf (getf options :ybound) (getf options :y))) + (when (getf options :y) (setf (getf options :ybounds) (getf options :y))) ;; Remove axes labels when no box is used in gnuplot (when (and (member :box options) (not (getf options :box)) @@ -2116,7 +2127,7 @@ sin(y)*(10.0+6*cos(x)), (case (getf options :plot_format) ($gnuplot - (gnuplot-process options file)) + (gnuplot-process options file output-file)) ($gnuplot_pipes (send-gnuplot-command *gnuplot-command*)) ($mgnuplot @@ -2618,7 +2629,7 @@ Several functions depending on the two variables v1 and v2: (t (close $pstream) (setq $pstream nil)))) (if (eql (getf options :plot_format) '$gnuplot) - (gnuplot-process options file) + (gnuplot-process options file output-file) (cond ((getf options :run_viewer) (case (getf options :plot_format) ($xmaxima diff --git a/src/xmaxima_def.lisp b/src/xmaxima_def.lisp index 53d3ead..536b49c 100644 --- a/src/xmaxima_def.lisp +++ b/src/xmaxima_def.lisp @@ -1,5 +1,5 @@ ;; xmaxima.lisp: routines for Maxima's interface to xmaxima -;; Copyright (C) 2007,2009 J. Villate +;; Copyright (C) 2007-2013 J. Villate ;; ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License @@ -195,8 +195,8 @@ (when azim (format dest " {az ~d}" azim)) (format dest "~%"))) - (when (getf plot-options :psfile) - (format dest " {psfile ~s}" (getf plot-options :psfile))) + (when (getf plot-options :ps_file) + (format dest " {psfile ~s}" (getf plot-options :ps_file))) (when (member :legend plot-options) (unless (getf plot-options :legend) (format dest " {nolegend 1}"))) ----------------------------------------------------------------------- Summary of changes: share/dynamics/complex_dynamics.lisp | 8 +- src/gnuplot_def.lisp | 199 ++++++++++++++++++++-------------- src/plot.lisp | 133 ++++++++++++----------- src/xmaxima_def.lisp | 6 +- 4 files changed, 197 insertions(+), 149 deletions(-) hooks/post-receive -- Maxima CAS |