help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getting the view of the current plot


From: John W. Eaton
Subject: getting the view of the current plot
Date: Tue, 15 Apr 2008 16:32:26 -0400

On 15-Apr-2008, Kamaraju S Kusumanchi wrote:

| Using Debian a combination of Etch+Lenny, octave 3.0.0-9
| 
| I would like to know how to obtain the current view of a plot. If I do
| 
| octave:1> [a, b] = view()
| error: `az' undefined near line 57 column 17
| error: evaluating assignment expression near line 57, column 15
| error: evaluating if command near line 56, column 5
| error: evaluating if command near line 30, column 3
| error: called from `view' in file `/usr/share/octave/3.0.0/m/plot/view.m'
| octave:1>                                                                  

Please try the following patch.

Please also report bugs on the address@hidden list.

Thanks,

jwe


# HG changeset patch
# User John W. Eaton <address@hidden>
# Date 1208291452 14400
# Branch release-3-0-x
# Node ID 93512a8fecb0aa5a9bc126fe3a95977b1fabccc4
# Parent  ebd29e89b09377427d5991188c8453f3a6d9fa3f
view: get values from current axes if nargin == 0

diff --git a/scripts/ChangeLog b/scripts/ChangeLog
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,7 @@ 2008-04-09  John W. Eaton  <address@hidden
+2008-04-15  John W. Eaton  <address@hidden>
+
+       * plot/view.m: Get values from current axes if nargin == 0.
+
 2008-04-09  John W. Eaton  <address@hidden>
 
        * deprecated/beta_cdf.m, deprecated/beta_inv.m,
diff --git a/scripts/plot/view.m b/scripts/plot/view.m
--- a/scripts/plot/view.m
+++ b/scripts/plot/view.m
@@ -28,7 +28,11 @@ function [azimuth, elevation] = view (x,
 function [azimuth, elevation] = view (x, y, z)
 
   if (nargin < 4)
-    if (nargin == 1)
+    if (nargin == 0)
+      tmp = get (gca (), "view");
+      az = tmp(1);
+      el = tmp(2);
+    elseif (nargin == 1)
       if (x == 2)
        az = 0;
        el = 90;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]