[python-arrayfire] 156/250: Fixing bug in graphics/plot3

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/master
in repository python-arrayfire.

commit 87cfb48337794040f50906ed38cf82686723cc30
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Wed Dec 9 13:36:21 2015 -0500

    Fixing bug in graphics/plot3
    
    - Also added example for plot3
---
 arrayfire/graphics.py      |  4 ++--
 examples/graphics/plot3.py | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/arrayfire/graphics.py b/arrayfire/graphics.py
index 4cc5969..5a84895 100644
--- a/arrayfire/graphics.py
+++ b/arrayfire/graphics.py
@@ -166,14 +166,14 @@ class Window(object):
         Paramters
         ---------
 
-        data: af.Array.
+        line: af.Array.
              A 2 dimensional array containing (X,Y,Z) co-ordinates.
 
         title: str.
              Title used for the plot.
         """
         _cell = _Cell(self._r, self._c, title, self._cmap)
-        safe_call(backend.get().af_draw_plot3(self._wnd, data.arr, ct.pointer(_cell)))
+        safe_call(backend.get().af_draw_plot3(self._wnd, line.arr, ct.pointer(_cell)))
 
     def surface(self, z_vals, x_vals, y_vals, title=None):
         """
diff --git a/examples/graphics/plot3.py b/examples/graphics/plot3.py
new file mode 100644
index 0000000..6f4beb9
--- /dev/null
+++ b/examples/graphics/plot3.py
@@ -0,0 +1,34 @@
+#!/usr/bin/python
+
+#######################################################
+# Copyright (c) 2015, ArrayFire
+# All rights reserved.
+#
+# This file is distributed under 3-clause BSD license.
+# The complete license agreement can be obtained at:
+# http://arrayfire.com/licenses/BSD-3-Clause
+########################################################
+
+import arrayfire as af
+import math
+
+af.info()
+
+ITERATIONS = 200
+POINTS = int(10.0 * ITERATIONS)
+
+Z = 1 + af.range(POINTS) / ITERATIONS
+
+win = af.Window(800, 800, "3D Plot example using ArrayFire")
+
+t = 0.1
+while not win.close():
+    X = af.cos(Z * t + t) / Z
+    Y = af.sin(Z * t + t) / Z
+
+    X = af.maxof(af.minof(X, 1), -1)
+    Y = af.maxof(af.minof(Y, 1), -1)
+
+    Pts = af.join(1, X, Y, Z)
+    win.plot3(Pts)
+    t = t + 0.01

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/python-arrayfire.git



More information about the debian-science-commits mailing list