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