1
|
1 /* |
|
2 |
2847
|
3 Copyright (C) 1996, 1997 John W. Eaton |
1
|
4 |
|
5 This file is part of Octave. |
|
6 |
|
7 Octave is free software; you can redistribute it and/or modify it |
|
8 under the terms of the GNU General Public License as published by the |
|
9 Free Software Foundation; either version 2, or (at your option) any |
|
10 later version. |
|
11 |
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 for more details. |
|
16 |
|
17 You should have received a copy of the GNU General Public License |
|
18 along with Octave; see the file COPYING. If not, write to the Free |
1315
|
19 Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
1
|
20 |
|
21 */ |
|
22 |
1297
|
23 #if defined (__GNUG__) |
|
24 #pragma implementation |
|
25 #endif |
|
26 |
240
|
27 #ifdef HAVE_CONFIG_H |
1192
|
28 #include <config.h> |
1
|
29 #endif |
|
30 |
1343
|
31 #include <cstring> |
|
32 |
3503
|
33 #include <fstream> |
|
34 #include <iostream> |
|
35 #include <strstream> |
1728
|
36 #include <string> |
|
37 |
1350
|
38 #ifdef HAVE_UNISTD_H |
2442
|
39 #ifdef HAVE_SYS_TYPES_H |
524
|
40 #include <sys/types.h> |
2442
|
41 #endif |
524
|
42 #include <unistd.h> |
|
43 #endif |
1
|
44 |
524
|
45 #include "SLStack.h" |
|
46 #include "procstream.h" |
|
47 |
1802
|
48 #include "file-ops.h" |
2891
|
49 #include "lo-mappers.h" |
1755
|
50 #include "str-vec.h" |
|
51 |
1352
|
52 #include "defun.h" |
|
53 #include "error.h" |
|
54 #include "gripes.h" |
|
55 #include "load-save.h" |
1742
|
56 #include "oct-obj.h" |
|
57 #include "pt-cmd.h" |
|
58 #include "pt-exp.h" |
|
59 #include "pt-plot.h" |
2124
|
60 #include "pt-walk.h" |
2209
|
61 #include "sighandlers.h" |
1750
|
62 #include "sysdep.h" |
1
|
63 #include "utils.h" |
2371
|
64 #include "variables.h" |
1
|
65 |
2176
|
66 // If TRUE, a replot command is issued automatically each time a plot |
|
67 // changes in some way. |
|
68 static bool Vautomatic_replot; |
|
69 |
|
70 // The name of the shell command to execute to start gnuplot. |
3523
|
71 static std::string Vgnuplot_binary; |
2176
|
72 |
2289
|
73 // TRUE if gnuplot appears to support multiple plot windows with X11. |
|
74 static bool Vgnuplot_has_frames; |
|
75 |
2176
|
76 // TRUE if gnuplot appears to support multiplot. |
|
77 static bool Vgnuplot_has_multiplot; |
|
78 |
1358
|
79 // The number of lines we've plotted so far. |
735
|
80 static int plot_line_count = 0; |
1
|
81 |
|
82 // Is this a parametric plot? Makes a difference for 3D plotting. |
1827
|
83 static bool parametric_plot = false; |
1
|
84 |
943
|
85 // The gnuplot terminal type. |
|
86 static char *gnuplot_terminal_type = 0; |
|
87 |
478
|
88 // Should the graph window be cleared before plotting the next line? |
1827
|
89 static bool clear_before_plotting = true; |
478
|
90 |
524
|
91 // List of files to delete when we exit or crash. |
2614
|
92 // |
|
93 // XXX FIXME XXX -- this should really be static, but that causes |
|
94 // problems on some systems. |
3523
|
95 SLStack <std::string> tmp_files; |
524
|
96 |
|
97 // Pipe to gnuplot. |
1449
|
98 static oprocstream *plot_stream = 0; |
524
|
99 |
2211
|
100 // ID of the plotter process. |
|
101 static pid_t plot_stream_pid = 0; |
|
102 |
3162
|
103 // Gnuplot command strings that we use. |
3523
|
104 static std::string Vgnuplot_command_plot; |
|
105 static std::string Vgnuplot_command_replot; |
|
106 static std::string Vgnuplot_command_splot; |
|
107 static std::string Vgnuplot_command_using; |
|
108 static std::string Vgnuplot_command_with; |
|
109 static std::string Vgnuplot_command_axes; |
|
110 static std::string Vgnuplot_command_title; |
|
111 static std::string Vgnuplot_command_end; |
866
|
112 |
597
|
113 static void |
2209
|
114 plot_stream_death_handler (pid_t pid, int) |
|
115 { |
|
116 close_plot_stream (); |
|
117 |
|
118 warning ("connection to external plotter (pid = %d) lost --", pid); |
|
119 warning ("please try your plot command(s) again"); |
|
120 } |
|
121 |
|
122 static void |
597
|
123 open_plot_stream (void) |
|
124 { |
1827
|
125 static bool initialized = false; |
597
|
126 |
1449
|
127 if (plot_stream && ! *plot_stream) |
|
128 { |
|
129 delete plot_stream; |
|
130 plot_stream = 0; |
|
131 } |
|
132 |
|
133 if (! plot_stream) |
597
|
134 { |
1827
|
135 initialized = false; |
943
|
136 |
597
|
137 plot_line_count = 0; |
|
138 |
3523
|
139 std::string plot_prog = Vgnuplot_binary; |
1755
|
140 |
2209
|
141 if (plot_prog.empty ()) |
|
142 plot_prog = "gnuplot"; |
|
143 |
|
144 // XXX FIXME XXX -- I'm not sure this is the right thing to do, |
|
145 // but without it, C-c at the octave prompt will kill gnuplot... |
|
146 |
2211
|
147 #if defined (HAVE_POSIX_SIGNALS) |
|
148 sigset_t set, oset; |
|
149 sigemptyset (&set); |
|
150 sigaddset (&set, SIGINT); |
|
151 sigprocmask (SIG_BLOCK, &set, &oset); |
2553
|
152 #else |
2705
|
153 volatile octave_interrupt_handler old_interrupt_handler |
2553
|
154 = octave_ignore_interrupts (); |
2211
|
155 #endif |
2209
|
156 |
|
157 plot_stream = new oprocstream (plot_prog.c_str ()); |
|
158 |
|
159 if (plot_stream) |
597
|
160 { |
2209
|
161 if (! *plot_stream) |
1449
|
162 { |
|
163 delete plot_stream; |
|
164 plot_stream = 0; |
2209
|
165 |
|
166 error ("plot: unable to open pipe to `%s'", plot_prog.c_str ()); |
1449
|
167 } |
2209
|
168 else |
597
|
169 { |
2211
|
170 plot_stream_pid = plot_stream->pid (); |
|
171 octave_child_list::insert (plot_stream_pid, |
|
172 plot_stream_death_handler); |
597
|
173 } |
|
174 } |
|
175 else |
2209
|
176 error ("plot: unable to open pipe to `%s'", plot_prog.c_str ()); |
2211
|
177 |
|
178 #if defined (HAVE_POSIX_SIGNALS) |
|
179 sigprocmask (SIG_SETMASK, &oset, 0); |
2553
|
180 #else |
|
181 octave_set_interrupt_handler (old_interrupt_handler); |
2211
|
182 #endif |
597
|
183 } |
|
184 |
1449
|
185 if (! error_state && plot_stream && *plot_stream && ! initialized) |
597
|
186 { |
1827
|
187 initialized = true; |
1449
|
188 *plot_stream << "set data style lines\n"; |
943
|
189 |
|
190 if (gnuplot_terminal_type) |
3162
|
191 *plot_stream << "set term " << gnuplot_terminal_type |
|
192 << Vgnuplot_command_end; |
597
|
193 } |
|
194 } |
|
195 |
|
196 static int |
|
197 send_to_plot_stream (const char *cmd) |
|
198 { |
1449
|
199 if (! (plot_stream && *plot_stream)) |
597
|
200 { |
|
201 open_plot_stream (); |
|
202 |
|
203 if (error_state) |
|
204 return -1; |
|
205 } |
|
206 |
3162
|
207 int replot_len = Vgnuplot_command_replot.length (); |
|
208 int splot_len = Vgnuplot_command_splot.length (); |
|
209 int plot_len = Vgnuplot_command_plot.length (); |
930
|
210 |
3162
|
211 bool is_replot = (Vgnuplot_command_replot.compare (cmd, 0, replot_len) == 0); |
|
212 bool is_splot = (Vgnuplot_command_splot.compare (cmd, 0, splot_len) == 0); |
|
213 bool is_plot = (Vgnuplot_command_plot.compare (cmd, 0, plot_len) == 0); |
661
|
214 |
|
215 if (plot_line_count == 0 && is_replot) |
597
|
216 error ("replot: no previous plot"); |
|
217 else |
|
218 { |
1449
|
219 *plot_stream << cmd; |
930
|
220 |
661
|
221 if (! (is_replot || is_splot || is_plot) |
|
222 && plot_line_count > 0 |
2176
|
223 && Vautomatic_replot) |
3162
|
224 *plot_stream << Vgnuplot_command_replot << Vgnuplot_command_end; |
930
|
225 |
1449
|
226 plot_stream->flush (); |
597
|
227 } |
|
228 |
|
229 return 0; |
|
230 } |
|
231 |
581
|
232 // Plotting, eh? |
1
|
233 |
|
234 tree_plot_command::~tree_plot_command (void) |
|
235 { |
|
236 delete range; |
|
237 delete plot_list; |
|
238 } |
|
239 |
578
|
240 void |
|
241 tree_plot_command::eval (void) |
1
|
242 { |
143
|
243 if (error_state) |
578
|
244 return; |
143
|
245 |
597
|
246 open_plot_stream (); |
|
247 |
3523
|
248 std::ostrstream plot_buf; |
1
|
249 |
|
250 switch (ndim) |
|
251 { |
476
|
252 case 1: |
478
|
253 if (plot_line_count == 0) |
|
254 { |
|
255 if (plot_list) |
3162
|
256 plot_buf << Vgnuplot_command_plot; |
478
|
257 else |
|
258 { |
|
259 ::error ("replot: must have something to plot"); |
578
|
260 return; |
478
|
261 } |
|
262 } |
|
263 else |
3162
|
264 plot_buf << Vgnuplot_command_replot; |
476
|
265 break; |
777
|
266 |
1
|
267 case 2: |
478
|
268 if (clear_before_plotting || plot_line_count == 0) |
|
269 { |
|
270 plot_line_count = 0; |
3162
|
271 plot_buf << Vgnuplot_command_plot; |
478
|
272 } |
|
273 else |
3162
|
274 plot_buf << Vgnuplot_command_replot; |
1
|
275 break; |
777
|
276 |
1
|
277 case 3: |
930
|
278 if (clear_before_plotting || plot_line_count == 0) |
|
279 { |
|
280 plot_line_count = 0; |
3162
|
281 plot_buf << Vgnuplot_command_splot; |
930
|
282 } |
|
283 else |
3162
|
284 plot_buf << Vgnuplot_command_replot; |
1
|
285 break; |
777
|
286 |
1
|
287 default: |
771
|
288 gripe_2_or_3_dim_plot (); |
|
289 return; |
1
|
290 } |
|
291 |
524
|
292 if (range) |
478
|
293 { |
|
294 if (plot_line_count == 0) |
|
295 range->print (ndim, plot_buf); |
|
296 else |
|
297 warning ("can't specify new plot ranges with `replot' or while\ |
|
298 hold is on"); |
|
299 } |
1
|
300 |
191
|
301 if (error_state) |
578
|
302 return; |
191
|
303 |
591
|
304 if (plot_list) |
1
|
305 { |
591
|
306 int status = plot_list->print (ndim, plot_buf); |
578
|
307 |
771
|
308 if (error_state || status < 0) |
578
|
309 return; |
1
|
310 } |
|
311 |
3162
|
312 plot_buf << Vgnuplot_command_end << ends; |
1
|
313 |
1358
|
314 // Just testing... |
|
315 // char *message = plot_buf.str (); |
3531
|
316 // std::cout << "[*]" << message << "[*]\n"; |
1
|
317 |
|
318 if (parametric_plot && ndim == 2) |
|
319 { |
|
320 warning ("can't make 2D parametric plot -- setting noparametric..."); |
|
321 send_to_plot_stream ("set noparametric\n"); |
|
322 char *message = plot_buf.str (); |
|
323 send_to_plot_stream (message); |
|
324 delete [] message; |
|
325 send_to_plot_stream ("set parametric\n"); |
|
326 } |
|
327 else |
|
328 { |
|
329 char *message = plot_buf.str (); |
|
330 send_to_plot_stream (message); |
|
331 delete [] message; |
|
332 } |
|
333 } |
|
334 |
591
|
335 void |
2124
|
336 tree_plot_command::accept (tree_walker& tw) |
1
|
337 { |
2124
|
338 tw.visit_plot_command (*this); |
1
|
339 } |
|
340 |
578
|
341 plot_limits::~plot_limits (void) |
1
|
342 { |
|
343 delete x_range; |
|
344 delete y_range; |
|
345 delete z_range; |
|
346 } |
|
347 |
|
348 void |
3523
|
349 plot_limits::print (int ndim, std::ostrstream& plot_buf) |
1
|
350 { |
|
351 if (ndim == 2 || ndim == 3) |
|
352 { |
524
|
353 if (x_range) |
1
|
354 x_range->print (plot_buf); |
|
355 else |
|
356 return; |
|
357 |
524
|
358 if (y_range) |
1
|
359 y_range->print (plot_buf); |
|
360 else |
|
361 return; |
|
362 } |
|
363 |
524
|
364 if (ndim == 3 && z_range) |
1
|
365 z_range->print (plot_buf); |
|
366 } |
|
367 |
591
|
368 void |
2124
|
369 plot_limits::accept (tree_walker& tw) |
591
|
370 { |
2124
|
371 tw.visit_plot_limits (*this); |
591
|
372 } |
|
373 |
578
|
374 plot_range::~plot_range (void) |
1
|
375 { |
|
376 delete lower; |
|
377 delete upper; |
|
378 } |
|
379 |
|
380 void |
3523
|
381 plot_range::print (std::ostrstream& plot_buf) |
1
|
382 { |
|
383 plot_buf << " ["; |
|
384 |
524
|
385 if (lower) |
1
|
386 { |
2972
|
387 octave_value lower_val = lower->rvalue (); |
|
388 |
191
|
389 if (error_state) |
|
390 { |
240
|
391 ::error ("evaluating lower bound of plot range"); |
191
|
392 return; |
|
393 } |
|
394 else |
|
395 { |
629
|
396 double lo = lower_val.double_value (); |
191
|
397 plot_buf << lo; |
|
398 } |
1
|
399 } |
|
400 |
|
401 plot_buf << ":"; |
|
402 |
524
|
403 if (upper) |
1
|
404 { |
2972
|
405 octave_value upper_val = upper->rvalue (); |
|
406 |
191
|
407 if (error_state) |
|
408 { |
240
|
409 ::error ("evaluating upper bound of plot range"); |
191
|
410 return; |
|
411 } |
|
412 else |
|
413 { |
629
|
414 double hi = upper_val.double_value (); |
191
|
415 plot_buf << hi; |
|
416 } |
1
|
417 } |
|
418 |
|
419 plot_buf << "]"; |
|
420 } |
|
421 |
591
|
422 void |
2124
|
423 plot_range::accept (tree_walker& tw) |
591
|
424 { |
2124
|
425 tw.visit_plot_range (*this); |
591
|
426 } |
|
427 |
578
|
428 subplot_using::~subplot_using (void) |
1
|
429 { |
|
430 delete scanf_fmt; |
|
431 } |
|
432 |
|
433 int |
872
|
434 subplot_using::eval (int ndim, int n_max) |
1
|
435 { |
2124
|
436 if ((ndim == 2 && qual_count > 4) |
|
437 || (ndim == 3 && qual_count > 3)) |
1
|
438 return -1; |
|
439 |
2124
|
440 if (qual_count > 0) |
|
441 val.resize (qual_count); |
872
|
442 |
2124
|
443 for (int i = 0; i < qual_count; i++) |
1
|
444 { |
524
|
445 if (x[i]) |
1
|
446 { |
2972
|
447 octave_value tmp = x[i]->rvalue (); |
|
448 |
191
|
449 if (error_state) |
|
450 { |
240
|
451 ::error ("evaluating plot using command"); |
191
|
452 return -1; |
|
453 } |
|
454 |
872
|
455 double val_tmp; |
1
|
456 if (tmp.is_defined ()) |
|
457 { |
872
|
458 val_tmp = tmp.double_value (); |
1
|
459 |
872
|
460 if (error_state) |
|
461 return -1; |
1
|
462 |
1086
|
463 if (xisnan (val_tmp)) |
|
464 { |
|
465 ::error ("NaN is invalid as a column specifier"); |
|
466 return -1; |
|
467 } |
|
468 |
872
|
469 int n = NINT (val_tmp); |
1086
|
470 |
322
|
471 if (n < 1 || n_max > 0 && n > n_max) |
1
|
472 { |
240
|
473 ::error ("using: column %d out of range", n); |
1
|
474 return -1; |
|
475 } |
|
476 else |
2305
|
477 val (i) = n; |
1
|
478 } |
|
479 else |
|
480 return -1; |
|
481 } |
|
482 else |
|
483 return -1; |
|
484 } |
|
485 |
524
|
486 if (scanf_fmt) |
1
|
487 warning ("ignoring scanf format in plot command"); |
|
488 |
872
|
489 return 0; |
|
490 } |
|
491 |
|
492 ColumnVector |
|
493 subplot_using::values (int ndim, int n_max) |
|
494 { |
|
495 int status = eval (ndim, n_max); |
|
496 |
1203
|
497 if (status < 0) |
872
|
498 return -1; |
|
499 |
|
500 return val; |
|
501 } |
|
502 |
|
503 int |
3523
|
504 subplot_using::print (int ndim, int n_max, std::ostrstream& plot_buf) |
872
|
505 { |
|
506 int status = eval (ndim, n_max); |
|
507 |
1203
|
508 if (status < 0) |
872
|
509 return -1; |
|
510 |
2124
|
511 for (int i = 0; i < qual_count; i++) |
872
|
512 { |
|
513 if (i == 0) |
3162
|
514 plot_buf << " " << Vgnuplot_command_using << " "; |
872
|
515 else |
|
516 plot_buf << ":"; |
|
517 |
2305
|
518 plot_buf << val (i); |
872
|
519 } |
|
520 |
1
|
521 return 0; |
|
522 } |
|
523 |
591
|
524 void |
2124
|
525 subplot_using::accept (tree_walker& tw) |
1
|
526 { |
2124
|
527 tw.visit_subplot_using (*this); |
1
|
528 } |
|
529 |
578
|
530 subplot_style::~subplot_style (void) |
1622
|
531 { |
2124
|
532 delete sp_linetype; |
|
533 delete sp_pointtype; |
1
|
534 } |
|
535 |
|
536 int |
3523
|
537 subplot_style::print (std::ostrstream& plot_buf) |
1
|
538 { |
2124
|
539 if (! sp_style.empty ()) |
1
|
540 { |
3162
|
541 plot_buf << " " << Vgnuplot_command_with << " " << sp_style; |
1
|
542 |
2124
|
543 if (sp_linetype) |
1
|
544 { |
2972
|
545 octave_value tmp = sp_linetype->rvalue (); |
|
546 |
191
|
547 if (! error_state && tmp.is_defined ()) |
1
|
548 { |
629
|
549 double val = tmp.double_value (); |
1086
|
550 if (xisnan (val)) |
|
551 { |
|
552 ::error ("NaN is invalid a plotting line style"); |
|
553 return -1; |
|
554 } |
|
555 else |
|
556 plot_buf << " " << NINT (val); |
1
|
557 } |
|
558 else |
191
|
559 { |
240
|
560 ::error ("evaluating plot style command"); |
191
|
561 return -1; |
|
562 } |
1
|
563 } |
|
564 |
2124
|
565 if (sp_pointtype) |
1
|
566 { |
2972
|
567 octave_value tmp = sp_pointtype->rvalue (); |
|
568 |
191
|
569 if (! error_state && tmp.is_defined ()) |
1
|
570 { |
629
|
571 double val = tmp.double_value (); |
1086
|
572 if (xisnan (val)) |
|
573 { |
|
574 ::error ("NaN is invalid a plotting point style"); |
|
575 return -1; |
|
576 } |
|
577 else |
|
578 plot_buf << " " << NINT (val); |
1
|
579 } |
|
580 else |
191
|
581 { |
240
|
582 ::error ("evaluating plot style command"); |
191
|
583 return -1; |
|
584 } |
1
|
585 } |
|
586 } |
|
587 else |
|
588 return -1; |
|
589 |
|
590 return 0; |
|
591 } |
|
592 |
2543
|
593 bool |
|
594 subplot_style::columns_ok (int nc) |
872
|
595 { |
2543
|
596 bool retval = true; |
|
597 |
|
598 if ((almost_match ("boxes", sp_style, 5, 0) && nc != 3) |
|
599 || (almost_match ("boxerrorbars", sp_style, 5, 0) |
|
600 && (! (nc == 3 || nc == 4 || nc == 5))) |
|
601 || ((almost_match ("boxxyerrorbars", sp_style, 4, 0) |
|
602 || almost_match ("xyerrorbars", sp_style, 2, 0)) |
|
603 && (! (nc == 4 || nc == 6 || nc == 7))) |
|
604 || ((almost_match ("candlesticks", sp_style, 1, 0) |
|
605 || almost_match ("financebars", sp_style, 2, 0)) |
|
606 && nc != 5) |
|
607 || ((almost_match ("errorbars", sp_style, 1, 0) |
|
608 || almost_match ("xerrorbars", sp_style, 1, 0) |
|
609 || almost_match ("yerrorbars", sp_style, 1, 0)) |
|
610 && (! (nc == 3 || nc == 4)))) |
|
611 { |
|
612 error |
|
613 ("invalid number of data columns = %d specified for plot style `%s'", |
|
614 nc, sp_style.c_str ()); |
|
615 |
|
616 retval = false; |
|
617 } |
|
618 |
|
619 return retval; |
872
|
620 } |
|
621 |
591
|
622 void |
2124
|
623 subplot_style::accept (tree_walker& tw) |
591
|
624 { |
2124
|
625 tw.visit_subplot_style (*this); |
591
|
626 } |
|
627 |
3165
|
628 int |
3523
|
629 subplot_axes::print (std::ostrstream& plot_buf) |
3165
|
630 { |
|
631 if (! sp_axes.empty ()) |
|
632 plot_buf << " " << Vgnuplot_command_axes << " " << sp_axes; |
|
633 |
|
634 return 0; |
|
635 } |
|
636 |
|
637 void |
|
638 subplot_axes::accept (tree_walker& tw) |
|
639 { |
|
640 tw.visit_subplot_axes (*this); |
|
641 } |
|
642 |
878
|
643 subplot::~subplot (void) |
|
644 { |
2124
|
645 delete sp_plot_data; |
|
646 delete sp_using_clause; |
|
647 delete sp_title_clause; |
|
648 delete sp_style_clause; |
3165
|
649 delete sp_axes_clause; |
878
|
650 } |
|
651 |
2086
|
652 octave_value |
|
653 subplot::extract_plot_data (int ndim, octave_value& data) |
872
|
654 { |
2086
|
655 octave_value retval; |
872
|
656 |
2124
|
657 if (sp_using_clause) |
872
|
658 { |
2124
|
659 ColumnVector val = sp_using_clause->values (ndim); |
872
|
660 |
2086
|
661 octave_value_list args; |
2963
|
662 |
872
|
663 args(1) = val; |
2086
|
664 args(0) = octave_value::magic_colon_t; |
872
|
665 |
2963
|
666 retval = data.do_index_op (args); |
872
|
667 |
|
668 if (error_state) |
2086
|
669 return octave_value (); |
872
|
670 } |
|
671 else |
|
672 { |
|
673 retval = data; |
|
674 } |
|
675 |
2543
|
676 int nc = retval.columns (); |
872
|
677 |
2543
|
678 if (ndim == 2 && sp_style_clause && ! sp_style_clause->columns_ok (nc)) |
|
679 return octave_value (); |
872
|
680 |
|
681 return retval; |
|
682 } |
|
683 |
591
|
684 int |
3523
|
685 subplot::handle_plot_data (int ndim, std::ostrstream& plot_buf) |
591
|
686 { |
2124
|
687 if (sp_plot_data) |
591
|
688 { |
2972
|
689 octave_value data = sp_plot_data->rvalue (); |
872
|
690 |
591
|
691 if (! error_state && data.is_defined ()) |
|
692 { |
3523
|
693 std::string file; |
1750
|
694 |
610
|
695 if (data.is_string ()) |
591
|
696 { |
1358
|
697 // Should really try to look at data file to determine |
|
698 // n_max. Can't do much about other arbitrary gnuplot |
|
699 // commands though... |
872
|
700 |
|
701 int n_max = 0; |
|
702 |
2926
|
703 file = file_ops::tilde_expand (data.string_value ()); |
1728
|
704 |
3523
|
705 std::ifstream ftmp (file.c_str ()); |
1750
|
706 |
591
|
707 if (ftmp) |
|
708 { |
|
709 plot_buf << " \"" << file << '"'; |
|
710 } |
|
711 else |
|
712 { |
1750
|
713 file = ""; |
591
|
714 |
1358
|
715 // Opening as a file failed. Let's try passing it |
|
716 // along as a plot command. |
|
717 |
591
|
718 plot_buf << " " << data.string_value (); |
872
|
719 } |
|
720 |
2124
|
721 if (sp_using_clause) |
872
|
722 { |
2124
|
723 int status = sp_using_clause->print (ndim, n_max, plot_buf); |
1750
|
724 |
872
|
725 if (status < 0) |
|
726 return -1; |
591
|
727 } |
|
728 } |
872
|
729 else |
591
|
730 { |
1358
|
731 // Eliminate the need for printing a using clause to |
|
732 // plot_buf. |
872
|
733 |
2086
|
734 octave_value tmp_data = extract_plot_data (ndim, data); |
872
|
735 |
|
736 if (tmp_data.is_defined ()) |
|
737 { |
|
738 switch (ndim) |
|
739 { |
|
740 case 2: |
|
741 file = save_in_tmp_file (tmp_data, ndim); |
|
742 break; |
777
|
743 |
872
|
744 case 3: |
|
745 file = save_in_tmp_file (tmp_data, ndim, |
|
746 parametric_plot); |
|
747 break; |
777
|
748 |
872
|
749 default: |
|
750 gripe_2_or_3_dim_plot (); |
|
751 break; |
|
752 } |
591
|
753 |
1750
|
754 if (file.length () > 0) |
872
|
755 { |
|
756 mark_for_deletion (file); |
|
757 plot_buf << " \"" << file << '"'; |
|
758 } |
|
759 } |
591
|
760 } |
|
761 } |
|
762 else |
|
763 return -1; |
|
764 } |
|
765 else |
|
766 return -1; |
|
767 |
872
|
768 return 0; |
|
769 } |
591
|
770 |
872
|
771 int |
3523
|
772 subplot::print (int ndim, std::ostrstream& plot_buf) |
872
|
773 { |
|
774 int status = handle_plot_data (ndim, plot_buf); |
|
775 |
|
776 if (status < 0) |
|
777 return -1; |
591
|
778 |
3165
|
779 if (sp_axes_clause) |
|
780 { |
|
781 int status = sp_axes_clause->print (plot_buf); |
|
782 if (status < 0) |
|
783 return -1; |
|
784 } |
|
785 |
2124
|
786 if (sp_title_clause) |
591
|
787 { |
2972
|
788 octave_value tmp = sp_title_clause->rvalue (); |
|
789 |
610
|
790 if (! error_state && tmp.is_string ()) |
3162
|
791 plot_buf << " " << Vgnuplot_command_title << " " |
866
|
792 << '"' << tmp.string_value () << '"'; |
591
|
793 else |
|
794 { |
|
795 warning ("line title must be a string"); |
3162
|
796 plot_buf << " " << Vgnuplot_command_title << " " |
866
|
797 << '"' << "line " << plot_line_count << '"'; |
591
|
798 } |
|
799 } |
|
800 else |
3162
|
801 plot_buf << " " << Vgnuplot_command_title << " " |
866
|
802 << '"' << "line " << plot_line_count << '"'; |
591
|
803 |
2124
|
804 if (sp_style_clause) |
591
|
805 { |
2124
|
806 int status = sp_style_clause->print (plot_buf); |
591
|
807 if (status < 0) |
|
808 return -1; |
|
809 } |
|
810 |
|
811 return 0; |
|
812 } |
|
813 |
|
814 void |
2124
|
815 subplot::accept (tree_walker& tw) |
591
|
816 { |
2124
|
817 tw.visit_subplot (*this); |
591
|
818 } |
|
819 |
1622
|
820 subplot_list::~subplot_list (void) |
|
821 { |
|
822 while (! empty ()) |
|
823 { |
|
824 subplot *t = remove_front (); |
|
825 delete t; |
|
826 } |
|
827 } |
|
828 |
883
|
829 int |
3523
|
830 subplot_list::print (int ndim, std::ostrstream& plot_buf) |
591
|
831 { |
|
832 int status = 0; |
|
833 |
|
834 for (Pix p = first (); p != 0; next (p)) |
|
835 { |
|
836 subplot *elt = this->operator () (p); |
|
837 |
|
838 plot_line_count++; |
|
839 |
|
840 if (p != first ()) |
|
841 plot_buf << ",\\\n "; |
|
842 |
|
843 status = elt->print (ndim, plot_buf); |
|
844 |
|
845 if (status < 0) |
|
846 break; |
|
847 } |
|
848 |
|
849 return status; |
|
850 } |
|
851 |
|
852 void |
2124
|
853 subplot_list::accept (tree_walker& tw) |
591
|
854 { |
2124
|
855 tw.visit_subplot_list (*this); |
591
|
856 } |
|
857 |
1755
|
858 string |
2086
|
859 save_in_tmp_file (octave_value& t, int ndim, bool parametric) |
524
|
860 { |
3523
|
861 std::string name = file_ops::tempnam ("", "oct-"); |
1755
|
862 |
|
863 if (! name.empty ()) |
524
|
864 { |
3523
|
865 std::ofstream file (name.c_str ()); |
1755
|
866 |
524
|
867 if (file) |
|
868 { |
|
869 switch (ndim) |
|
870 { |
|
871 case 2: |
2799
|
872 save_ascii_data (file, t, name, true); |
524
|
873 break; |
777
|
874 |
524
|
875 case 3: |
607
|
876 save_three_d (file, t, parametric); |
524
|
877 break; |
777
|
878 |
524
|
879 default: |
771
|
880 gripe_2_or_3_dim_plot (); |
524
|
881 break; |
|
882 } |
|
883 } |
|
884 else |
|
885 { |
1755
|
886 error ("couldn't open temporary output file `%s'", name.c_str ()); |
|
887 name.resize (0); |
524
|
888 } |
|
889 } |
1755
|
890 |
524
|
891 return name; |
|
892 } |
|
893 |
|
894 void |
3523
|
895 mark_for_deletion (const std::string& file) |
524
|
896 { |
1750
|
897 tmp_files.push (file); |
524
|
898 } |
|
899 |
|
900 void |
|
901 cleanup_tmp_files (void) |
|
902 { |
|
903 while (! tmp_files.empty ()) |
|
904 { |
3523
|
905 std::string filename = tmp_files.pop (); |
1750
|
906 unlink (filename.c_str ()); |
524
|
907 } |
|
908 } |
|
909 |
|
910 void |
|
911 close_plot_stream (void) |
|
912 { |
2211
|
913 octave_child_list::remove (plot_stream_pid); |
|
914 |
1449
|
915 if (plot_stream) |
|
916 { |
3189
|
917 send_to_plot_stream ("\nquit\n"); |
1449
|
918 delete plot_stream; |
|
919 plot_stream = 0; |
|
920 } |
524
|
921 |
|
922 plot_line_count = 0; |
|
923 } |
|
924 |
1328
|
925 void |
3523
|
926 do_external_plotter_cd (const std::string& newdir) |
1328
|
927 { |
1449
|
928 if (plot_stream && *plot_stream) |
1328
|
929 { |
3523
|
930 std::ostrstream plot_buf; |
3162
|
931 plot_buf << "cd \"" << newdir << "\"" << Vgnuplot_command_end << ends; |
1328
|
932 char *message = plot_buf.str (); |
|
933 send_to_plot_stream (message); |
|
934 delete [] message; |
|
935 } |
|
936 } |
|
937 |
1957
|
938 DEFUN (clearplot, , , |
3368
|
939 "-*- texinfo -*-\n\ |
|
940 @deftypefn {Built-in Function} {} clearplot\n\ |
|
941 @deftypefnx {Built-in Function} {} clg\n\ |
|
942 Clear the plot window and any titles or axis labels. The name\n\ |
|
943 @code{clg} is aliased to @code{clearplot} for compatibility with\n\ |
|
944 @sc{Matlab}.\n\ |
|
945 \n\ |
|
946 The commands @kbd{gplot clear}, @kbd{gsplot clear}, and @kbd{replot\n\ |
|
947 clear} are equivalent to @code{clearplot}. (Previously, commands like\n\ |
|
948 @kbd{gplot clear} would evaluate @code{clear} as an ordinary expression\n\ |
|
949 and clear all the visible variables.)\n\ |
|
950 @end deftypefn") |
883
|
951 { |
2086
|
952 octave_value_list retval; |
883
|
953 send_to_plot_stream ("clear\n"); |
930
|
954 |
1358
|
955 // XXX FIXME XXX -- instead of just clearing these things, it would |
|
956 // be nice if we could reset things to a user-specified default |
|
957 // state. |
930
|
958 |
|
959 send_to_plot_stream ("set title\n"); |
|
960 send_to_plot_stream ("set xlabel\n"); |
|
961 send_to_plot_stream ("set ylabel\n"); |
940
|
962 send_to_plot_stream ("set nogrid\n"); |
1000
|
963 send_to_plot_stream ("set nolabel\n"); |
940
|
964 |
1358
|
965 // This makes a simple `replot' not work after a `clearplot' command |
|
966 // has been issued. |
940
|
967 |
|
968 plot_line_count = 0; |
930
|
969 |
883
|
970 return retval; |
|
971 } |
|
972 |
884
|
973 DEFALIAS (clg, clearplot); |
|
974 |
1957
|
975 DEFUN (closeplot, , , |
3368
|
976 "-*- texinfo -*-\n\ |
|
977 @deftypefn {Built-in Function} {} closeplot\n\ |
|
978 Close stream to the @code{gnuplot} subprocess. If you are using X11,\n\ |
|
979 this will close the plot window.\n\ |
|
980 @end deftypefn") |
524
|
981 { |
2086
|
982 octave_value_list retval; |
524
|
983 close_plot_stream (); |
|
984 return retval; |
|
985 } |
|
986 |
1957
|
987 DEFUN_TEXT (hold, args, , |
3368
|
988 "-*- texinfo -*-\n\ |
|
989 @deftypefn {Built-in Function} {} hold @var{args}\n\ |
|
990 Tell Octave to `hold' the current data on the plot when executing\n\ |
|
991 subsequent plotting commands. This allows you to execute a series of\n\ |
|
992 plot commands and have all the lines end up on the same figure. The\n\ |
|
993 default is for each new plot command to clear the plot device first.\n\ |
|
994 For example, the command\n\ |
524
|
995 \n\ |
3368
|
996 @example\n\ |
|
997 hold on\n\ |
|
998 @end example\n\ |
|
999 \n\ |
|
1000 @noindent\n\ |
|
1001 turns the hold state on. An argument of @code{off} turns the hold state\n\ |
|
1002 off, and @code{hold} with no arguments toggles the current hold state.\n\ |
|
1003 @end deftypefn") |
524
|
1004 { |
2086
|
1005 octave_value_list retval; |
524
|
1006 |
1755
|
1007 int argc = args.length () + 1; |
|
1008 |
1968
|
1009 string_vector argv = args.make_argv ("hold"); |
1755
|
1010 |
|
1011 if (error_state) |
|
1012 return retval; |
524
|
1013 |
|
1014 switch (argc) |
|
1015 { |
|
1016 case 1: |
|
1017 clear_before_plotting = ! clear_before_plotting; |
|
1018 break; |
777
|
1019 |
524
|
1020 case 2: |
1755
|
1021 if (argv[1] == "on") |
1827
|
1022 clear_before_plotting = false; |
1755
|
1023 else if (argv[1] == "off") |
1827
|
1024 clear_before_plotting = true; |
524
|
1025 else |
|
1026 print_usage ("hold"); |
|
1027 break; |
777
|
1028 |
524
|
1029 default: |
|
1030 print_usage ("hold"); |
|
1031 break; |
|
1032 } |
|
1033 |
|
1034 return retval; |
|
1035 } |
|
1036 |
1957
|
1037 DEFUN (ishold, , , |
3368
|
1038 "-*- texinfo -*-\n\ |
|
1039 @deftypefn {Built-in Function} {} ishold\n\ |
|
1040 Return 1 if the next line will be added to the current plot, or 0 if\n\ |
|
1041 the plot device will be cleared before drawing the next line.\n\ |
|
1042 @end deftypefn") |
735
|
1043 { |
2800
|
1044 return static_cast<double> (! clear_before_plotting); |
735
|
1045 } |
|
1046 |
1957
|
1047 DEFUN (purge_tmp_files, , , |
3368
|
1048 "-*- texinfo -*-\n\ |
|
1049 @deftypefn {Built-in Function} {} purge_tmp_files\n\ |
|
1050 Delete the temporary files created by the plotting commands.\n\ |
|
1051 \n\ |
|
1052 Octave creates temporary data files for @code{gnuplot} and then sends\n\ |
|
1053 commands to @code{gnuplot} through a pipe. Octave will delete the\n\ |
|
1054 temporary files on exit, but if you are doing a lot of plotting you may\n\ |
|
1055 want to clean up in the middle of a session.\n\ |
|
1056 \n\ |
|
1057 A future version of Octave will eliminate the need to use temporary\n\ |
|
1058 files to hold the plot data.\n\ |
|
1059 @end deftypefn") |
524
|
1060 { |
2086
|
1061 octave_value_list retval; |
524
|
1062 cleanup_tmp_files (); |
|
1063 return retval; |
|
1064 } |
|
1065 |
3180
|
1066 |
|
1067 DEFUN (graw, args, , |
3442
|
1068 "-*- texinfo -*-\n\ |
|
1069 @deftypefn {Built-in Function} {} graw (@var{string})\n\ |
|
1070 Send @var{string} directly to gnuplot subprocess.\n\ |
|
1071 @end deftypefn") |
3180
|
1072 { |
|
1073 octave_value_list retval; |
|
1074 |
|
1075 if (args.length () == 1 && args(0).is_string ()) |
|
1076 { |
3523
|
1077 std::string cmd = args(0).string_value (); |
3180
|
1078 |
|
1079 if (! (plot_stream && *plot_stream)) |
|
1080 open_plot_stream (); |
|
1081 |
|
1082 if (! error_state) |
|
1083 { |
|
1084 *plot_stream << cmd; |
|
1085 |
|
1086 plot_stream->flush (); |
|
1087 } |
|
1088 } |
|
1089 else |
|
1090 print_usage ("graw"); |
|
1091 |
|
1092 return retval; |
|
1093 } |
|
1094 |
2520
|
1095 DEFUN_TEXT (gset, args, , |
3442
|
1096 "-*- texinfo -*-\n\ |
|
1097 @deffn {Command} gset options\n\ |
|
1098 Set plotting options for gnuplot\n\ |
|
1099 @end deffn") |
524
|
1100 { |
2086
|
1101 octave_value_list retval; |
524
|
1102 |
1755
|
1103 int argc = args.length () + 1; |
|
1104 |
1968
|
1105 string_vector argv = args.make_argv ("set"); |
1755
|
1106 |
|
1107 if (error_state) |
|
1108 return retval; |
524
|
1109 |
3523
|
1110 std::ostrstream plot_buf; |
524
|
1111 |
|
1112 if (argc > 1) |
|
1113 { |
|
1114 if (almost_match ("parametric", argv[1], 3)) |
1827
|
1115 parametric_plot = true; |
524
|
1116 else if (almost_match ("noparametric", argv[1], 5)) |
1827
|
1117 parametric_plot = false; |
943
|
1118 else if (almost_match ("term", argv[1], 1)) |
|
1119 { |
|
1120 delete [] gnuplot_terminal_type; |
3523
|
1121 std::ostrstream buf; |
3476
|
1122 int i; |
|
1123 for (i = 2; i < argc-1; i++) |
943
|
1124 buf << argv[i] << " "; |
3476
|
1125 if (i < argc) |
|
1126 buf << argv[i]; |
3162
|
1127 buf << Vgnuplot_command_end << ends; |
943
|
1128 gnuplot_terminal_type = buf.str (); |
|
1129 } |
524
|
1130 } |
|
1131 |
3476
|
1132 int i; |
|
1133 for (i = 0; i < argc-1; i++) |
524
|
1134 plot_buf << argv[i] << " "; |
|
1135 |
3476
|
1136 if (i < argc) |
|
1137 plot_buf << argv[i]; |
|
1138 |
3162
|
1139 plot_buf << Vgnuplot_command_end << ends; |
524
|
1140 |
|
1141 char *plot_command = plot_buf.str (); |
|
1142 send_to_plot_stream (plot_command); |
|
1143 |
|
1144 delete [] plot_command; |
|
1145 |
|
1146 return retval; |
|
1147 } |
|
1148 |
2520
|
1149 DEFUN_TEXT (set, args, nargout, |
3458
|
1150 "-*- texinfo -*-\n\ |
|
1151 This command is has been replaced by @code{gset}.") |
2520
|
1152 { |
2521
|
1153 warning ("set is obsolete -- use gset instead"); |
2520
|
1154 return Fgset (args, nargout); |
|
1155 } |
|
1156 |
|
1157 DEFUN_TEXT (gshow, args, , |
3442
|
1158 "-*- texinfo -*-\n\ |
|
1159 @deffn {Command} gshow options\n\ |
|
1160 Show plotting options.\n\ |
|
1161 @end deffn") |
524
|
1162 { |
2086
|
1163 octave_value_list retval; |
524
|
1164 |
1755
|
1165 int argc = args.length () + 1; |
|
1166 |
1968
|
1167 string_vector argv = args.make_argv ("show"); |
1755
|
1168 |
|
1169 if (error_state) |
|
1170 return retval; |
524
|
1171 |
3523
|
1172 std::ostrstream plot_buf; |
524
|
1173 |
3476
|
1174 int i; |
|
1175 for (i = 0; i < argc-1; i++) |
524
|
1176 plot_buf << argv[i] << " "; |
3476
|
1177 if (i < argc) |
|
1178 plot_buf << argv[i]; |
524
|
1179 |
3162
|
1180 plot_buf << Vgnuplot_command_end << ends; |
524
|
1181 |
|
1182 char *plot_command = plot_buf.str (); |
|
1183 send_to_plot_stream (plot_command); |
|
1184 |
|
1185 delete [] plot_command; |
|
1186 |
|
1187 return retval; |
|
1188 } |
|
1189 |
2520
|
1190 DEFUN_TEXT (show, args, nargout, |
3458
|
1191 "-*- texinfo -*-\n\ |
|
1192 This command is has been replaced by @code{gshow}.") |
2520
|
1193 { |
2521
|
1194 warning ("show is obsolete -- use gshow instead"); |
2520
|
1195 return Fgshow (args, nargout); |
|
1196 } |
|
1197 |
2176
|
1198 static int |
|
1199 automatic_replot (void) |
|
1200 { |
|
1201 Vautomatic_replot = check_preference ("automatic_replot"); |
|
1202 |
|
1203 return 0; |
|
1204 } |
|
1205 |
3162
|
1206 static int |
3523
|
1207 set_string_var (std::string& var, const char *nm) |
2176
|
1208 { |
3162
|
1209 int retval = 0; |
2176
|
1210 |
3523
|
1211 std::string s = builtin_string_variable (nm); |
2176
|
1212 |
|
1213 if (s.empty ()) |
|
1214 { |
3162
|
1215 gripe_invalid_value_specified (nm); |
|
1216 retval = -1; |
2176
|
1217 } |
|
1218 else |
3162
|
1219 var = s; |
|
1220 |
|
1221 return retval; |
|
1222 } |
|
1223 |
|
1224 static int |
|
1225 gnuplot_binary (void) |
|
1226 { |
|
1227 return set_string_var (Vgnuplot_binary, "gnuplot_binary"); |
|
1228 } |
|
1229 |
|
1230 static int |
|
1231 gnuplot_command_plot (void) |
|
1232 { |
|
1233 return set_string_var (Vgnuplot_command_plot, "gnuplot_command_plot"); |
|
1234 } |
|
1235 |
|
1236 static int |
|
1237 gnuplot_command_replot (void) |
|
1238 { |
|
1239 return set_string_var (Vgnuplot_command_replot, "gnuplot_command_replot"); |
|
1240 } |
2176
|
1241 |
3162
|
1242 static int |
|
1243 gnuplot_command_splot (void) |
|
1244 { |
|
1245 return set_string_var (Vgnuplot_command_splot, "gnuplot_command_splot"); |
|
1246 } |
|
1247 |
|
1248 static int |
|
1249 gnuplot_command_using (void) |
|
1250 { |
|
1251 return set_string_var (Vgnuplot_command_using, "gnuplot_command_using"); |
|
1252 } |
|
1253 |
|
1254 static int |
|
1255 gnuplot_command_with (void) |
|
1256 { |
|
1257 return set_string_var (Vgnuplot_command_with, "gnuplot_command_with"); |
|
1258 } |
|
1259 |
|
1260 static int |
3165
|
1261 gnuplot_command_axes (void) |
|
1262 { |
|
1263 return set_string_var (Vgnuplot_command_axes, "gnuplot_command_axes"); |
|
1264 } |
|
1265 |
|
1266 static int |
3162
|
1267 gnuplot_command_title (void) |
|
1268 { |
|
1269 return set_string_var (Vgnuplot_command_title, "gnuplot_command_title"); |
|
1270 } |
|
1271 |
|
1272 static int |
|
1273 gnuplot_command_end (void) |
|
1274 { |
|
1275 return set_string_var (Vgnuplot_command_end, "gnuplot_command_end"); |
2176
|
1276 } |
|
1277 |
|
1278 static int |
2289
|
1279 gnuplot_has_frames (void) |
|
1280 { |
|
1281 Vgnuplot_has_frames = check_preference ("gnuplot_has_frames"); |
|
1282 |
|
1283 return 0; |
|
1284 } |
|
1285 |
|
1286 static int |
2176
|
1287 gnuplot_has_multiplot (void) |
|
1288 { |
|
1289 Vgnuplot_has_multiplot = check_preference ("gnuplot_has_multiplot"); |
|
1290 |
|
1291 return 0; |
|
1292 } |
|
1293 |
|
1294 void |
|
1295 symbols_of_pt_plot (void) |
|
1296 { |
3258
|
1297 DEFVAR (automatic_replot, 0.0, automatic_replot, |
3368
|
1298 "-*- texinfo -*-\n\ |
|
1299 @defvr {Built-in Variable} automatic_replot\n\ |
|
1300 You can tell Octave to redisplay the plot each time anything about it\n\ |
|
1301 changes by setting the value of the builtin variable\n\ |
|
1302 @code{automatic_replot} to a nonzero value. Since this is fairly\n\ |
|
1303 inefficient, the default value is 0.\n\ |
|
1304 @end defvr"); |
2176
|
1305 |
3258
|
1306 DEFVAR (gnuplot_binary, "gnuplot", gnuplot_binary, |
3368
|
1307 "-*- texinfo -*-\n\ |
|
1308 @defvr {Built-in Variable} gnuplot_binary\n\ |
|
1309 The name of the program invoked by the plot command. The default value\n\ |
|
1310 is @code{\"gnuplot\"}. @xref{Installation}.\n\ |
|
1311 @end defvr"); |
2176
|
1312 |
3258
|
1313 DEFVAR (gnuplot_command_plot, "pl", gnuplot_command_plot, |
3442
|
1314 "-*- texinfo -*-\n\ |
|
1315 @defvr {Built-in Variable} gnuplot_command_plot\n\ |
|
1316 @end defvr"); |
3162
|
1317 |
3258
|
1318 DEFVAR (gnuplot_command_replot, "rep", gnuplot_command_replot, |
3442
|
1319 "-*- texinfo -*-\n\ |
|
1320 @defvr {Built-in Variable} gnuplot_command_replot\n\ |
|
1321 @end defvr"); |
3162
|
1322 |
3258
|
1323 DEFVAR (gnuplot_command_splot, "sp", gnuplot_command_splot, |
3442
|
1324 "-*- texinfo -*-\n\ |
|
1325 @defvr {Built-in Variable} gnuplot_command_splot\n\ |
|
1326 @end defvr"); |
3162
|
1327 |
3258
|
1328 DEFVAR (gnuplot_command_using, "u", gnuplot_command_using, |
3442
|
1329 "-*- texinfo -*-\n\ |
|
1330 @defvr {Built-in Variable} gnuplot_command_using\n\ |
|
1331 @end defvr"); |
3162
|
1332 |
3258
|
1333 DEFVAR (gnuplot_command_with, "w", gnuplot_command_with, |
3442
|
1334 "-*- texinfo -*-\n\ |
|
1335 @defvr {Built-in Variable} gnuplot_command_with\n\ |
|
1336 @end defvr"); |
3162
|
1337 |
3258
|
1338 DEFVAR (gnuplot_command_axes, "ax", gnuplot_command_axes, |
3442
|
1339 "-*- texinfo -*-\n\ |
|
1340 @defvr {Built-in Variable} gnuplot_command_axes\n\ |
|
1341 @end defvr"); |
3165
|
1342 |
3258
|
1343 DEFVAR (gnuplot_command_title, "t", gnuplot_command_title, |
3442
|
1344 "-*- texinfo -*-\n\ |
|
1345 @defvr {Built-in Variable} gnuplot_command_title\n\ |
|
1346 @end defvr"); |
3162
|
1347 |
3258
|
1348 DEFVAR (gnuplot_command_end, "\n", gnuplot_command_end, |
3442
|
1349 "-*- texinfo -*-\n\ |
|
1350 @defvr {Built-in Variable} gnuplot_command_end\n\ |
|
1351 @end defvr"); |
3162
|
1352 |
2289
|
1353 #ifdef GNUPLOT_HAS_FRAMES |
|
1354 double with_frames = 1.0; |
|
1355 #else |
|
1356 double with_frames = 0.0; |
|
1357 #endif |
|
1358 |
3258
|
1359 DEFVAR (gnuplot_has_frames, with_frames, gnuplot_has_frames, |
3368
|
1360 "-*- texinfo -*-\n\ |
|
1361 @defvr {Built-in Variable} gnuplot_has_frames\n\ |
|
1362 If the value of this variable is nonzero, Octave assumes that your copy\n\ |
|
1363 of gnuplot has support for multiple frames that is included in recent\n\ |
|
1364 3.6beta releases. It's initial value is determined by configure, but it\n\ |
|
1365 can be changed in your startup script or at the command line in case\n\ |
|
1366 configure got it wrong, or if you upgrade your gnuplot installation.\n\ |
|
1367 @end defvr"); |
2289
|
1368 |
2176
|
1369 #ifdef GNUPLOT_HAS_MULTIPLOT |
|
1370 double with_multiplot = 1.0; |
|
1371 #else |
|
1372 double with_multiplot = 0.0; |
|
1373 #endif |
|
1374 |
3258
|
1375 DEFVAR (gnuplot_has_multiplot, with_multiplot, gnuplot_has_multiplot, |
3368
|
1376 "-*- texinfo -*-\n\ |
|
1377 @defvr {Built-in Variable} gnuplot_has_multiplot\n\ |
|
1378 If the value of this variable is nonzero, Octave assumes that your copy\n\ |
|
1379 of gnuplot has the multiplot support that is included in recent\n\ |
|
1380 3.6beta releases. It's initial value is determined by configure, but it\n\ |
|
1381 can be changed in your startup script or at the command line in case\n\ |
|
1382 configure got it wrong, or if you upgrade your gnuplot installation.\n\ |
|
1383 @end defvr"); |
2176
|
1384 } |
|
1385 |
1
|
1386 /* |
|
1387 ;;; Local Variables: *** |
|
1388 ;;; mode: C++ *** |
|
1389 ;;; End: *** |
|
1390 */ |