~ubuntu-branches/debian/sid/octave3.0/sid

« back to all changes in this revision

Viewing changes to scripts/plot/__plt2vv__.m

  • Committer: Bazaar Package Importer
  • Author(s): Rafael Laboissiere
  • Date: 2007-12-23 16:04:15 UTC
  • Revision ID: james.westby@ubuntu.com-20071223160415-n4gk468dihy22e9v
Tags: upstream-3.0.0
ImportĀ upstreamĀ versionĀ 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
## Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2003, 2005,
 
2
##               2006, 2007 John W. Eaton
 
3
##
 
4
## This file is part of Octave.
 
5
##
 
6
## Octave is free software; you can redistribute it and/or modify it
 
7
## under the terms of the GNU General Public License as published by
 
8
## the Free Software Foundation; either version 3 of the License, or (at
 
9
## your option) any later version.
 
10
##
 
11
## Octave is distributed in the hope that it will be useful, but
 
12
## WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
## General Public License for more details.
 
15
##
 
16
## You should have received a copy of the GNU General Public License
 
17
## along with Octave; see the file COPYING.  If not, see
 
18
## <http://www.gnu.org/licenses/>.
 
19
 
 
20
## Undocumented internal function.
 
21
 
 
22
## Author: jwe
 
23
 
 
24
function retval = __plt2vv__ (h, x, y, options, properties)
 
25
 
 
26
  if (nargin < 3 || nargin > 5)
 
27
    print_usage ();
 
28
  endif
 
29
 
 
30
  if (nargin < 4 || isempty (options))
 
31
    options = __default_plot_options__ ();
 
32
  endif
 
33
 
 
34
  if (nargin < 5)
 
35
    properties = {};
 
36
  endif
 
37
 
 
38
  if (numel (options) > 1)
 
39
    options = options(1);
 
40
  endif
 
41
 
 
42
  [x_nr, x_nc] = size (x);
 
43
  [y_nr, y_nc] = size (y);
 
44
 
 
45
  if (x_nr == 1)
 
46
    x = x';
 
47
    tmp = x_nr;
 
48
    x_nr = x_nc;
 
49
    x_nc = tmp;
 
50
  endif
 
51
 
 
52
  if (y_nr == 1)
 
53
    y = y';
 
54
    tmp = y_nr;
 
55
    y_nr = y_nc;
 
56
    y_nc = tmp;
 
57
  endif
 
58
 
 
59
  if (x_nr == y_nr)
 
60
    key = options.key;
 
61
    if (! isempty (key))
 
62
      set (h, "key", "on");
 
63
    endif
 
64
    color = options.color;
 
65
    if (isempty (color))
 
66
      color = __next_line_color__ ();
 
67
    endif
 
68
    retval = line (x, y, "keylabel", key, "color", color,
 
69
                   "linestyle", options.linestyle,
 
70
                   "marker", options.marker, properties{:});
 
71
  else
 
72
    error ("__plt2vv__: vector lengths must match");
 
73
  endif
 
74
 
 
75
endfunction