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