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