annotate scripts/plot/__plt3__.m @ 6163:8614649c454c

[project @ 2006-11-14 18:52:34 by jwe]
author jwe
date Tue, 14 Nov 2006 18:52:39 +0000
parents 1a6d826e92b5
children 17f25cd588b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
1 ## Copyright (C) 1996 John W. Eaton
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
2 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
3 ## This file is part of Octave.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
4 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
5 ## Octave is free software; you can redistribute it and/or modify it
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
6 ## under the terms of the GNU General Public License as published by
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
7 ## the Free Software Foundation; either version 2, or (at your option)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
8 ## any later version.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
9 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
10 ## Octave is distributed in the hope that it will be useful, but
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
11 ## WITHOUT ANY WARRANTY; without even the implied warranty of
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
13 ## General Public License for more details.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
14 ##
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
15 ## You should have received a copy of the GNU General Public License
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
16 ## along with Octave; see the file COPYING. If not, write to the Free
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
17 ## Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
18 ## 02110-1301, USA.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
19
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
20 ## -*- texinfo -*-
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
21 ## @deftypefn {Function File} {} __plt3__ (@var{x}, @var{y}, @var{z}, @var{fmt})
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
22 ## @end deftypefn
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
23
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
24 ## Author: Paul Kienzle <kienzle.powernet.co.uk>
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
25 ## 2001-04-06 Paul Kienzle <kienzle.powernet.co.uk>
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
26 ## * __gnuplot_set__ nohidden3d; vector X,Y, matrix Z => meshgrid(X,Y)
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
27
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
28 ## Modified to use new gnuplot interface in octave > 2.9.0
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
29 ## Dmitri A. Sergatskov <dasergatskov@gmail.com>
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
30 ## April 18, 2005
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
31 ## Modified to use NaN as seperator for gnuplot, so multiple calls
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
32 ## aren't needed.
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
33 ## David Bateman <dbateman@free.fr>
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
34 ## May 25, 2006
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
35
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
36 function __plt3__ (x, usingstr, fmtstr, keystr, withstr)
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
37
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
38 if (nargin < 2)
6075
eaeff5ddfae5 [project @ 2006-10-24 15:02:12 by jwe]
jwe
parents: 6004
diff changeset
39 have_usingstr = false;
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
40 usingstr = "";
6076
b15a143c5607 [project @ 2006-10-24 16:09:21 by jwe]
jwe
parents: 6075
diff changeset
41 else
b15a143c5607 [project @ 2006-10-24 16:09:21 by jwe]
jwe
parents: 6075
diff changeset
42 have_usingstr = true;
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
43 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
44 if (nargin < 3)
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
45 fmtstr = "";
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
46 endif
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
47 if (nargin < 4)
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
48 keystr = "";
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
49 endif
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
50 if (nargin < 5)
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
51 withstr = "";
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
52 endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
53
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
54 __plot_globals__;
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
55
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
56 cf = __current_figure__;
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 6146
diff changeset
57 mxi = __multiplot_xi__(cf);
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 6146
diff changeset
58 myi = __multiplot_yi__(cf);
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
59
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
60 __setup_plot__ ("__gnuplot_splot__");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
61
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
62 j = __plot_data_offset__{cf}(mxi,myi);
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
63 loff = __plot_line_offset__{cf}(mxi,myi);
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
64 loff1 = loff;
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
65
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
66 __plot_data__{cf}{mxi,myi}{j} = x;
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
67 __plot_key_labels__{cf}{mxi,myi}{loff1++} = keystr;
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
68
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
69 if (! have_usingstr)
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
70 usingstr = __make_using_clause__ (__plot_data__{cf}{mxi,myi}{j});
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
71 endif
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
72
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
73 __plot_command__{cf}{mxi,myi} ...
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 6146
diff changeset
74 = sprintf ("%s%s __plot_data__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d} %s %s %s __plot_key_labels__{__current_figure__}{__multiplot_xi__(__current_figure__),__multiplot_yi__(__current_figure__)}{%d} %s",
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
75 __plot_command__{cf}{mxi,myi},
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
76 __plot_command_sep__, j++, usingstr, fmtstr,
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
77 gnuplot_command_title, loff++, withstr);
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
78 __plot_command_sep__ = ",\\\n";
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
79
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
80 __plot_data_offset__{cf}(mxi,myi) = j;
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
81 __plot_line_offset__{cf}(mxi,myi) = loff;
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
82
6163
8614649c454c [project @ 2006-11-14 18:52:34 by jwe]
jwe
parents: 6146
diff changeset
83 if (__multiplot_mode__(cf))
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
84 __gnuplot_raw__ ("clear\n");
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
85 endif
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
86
6146
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
87 if (! strcmp (__plot_command__{cf}{mxi,myi}, "__gnuplot_splot__"))
1a6d826e92b5 [project @ 2006-11-09 03:13:11 by jwe]
jwe
parents: 6076
diff changeset
88 eval (__plot_command__{cf}{mxi,myi});
6004
01556febbaaf [project @ 2006-09-26 21:16:52 by jwe]
jwe
parents: 5838
diff changeset
89 endif
5837
55404f3b0da1 [project @ 2006-06-01 19:05:31 by jwe]
jwe
parents:
diff changeset
90 endfunction