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