Skip to content

Commit 87cfb48

Browse files
committed
Fixing bug in graphics/plot3
- Also added example for plot3
1 parent c7c273f commit 87cfb48

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

arrayfire/graphics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,14 @@ def plot3(self, line, title=None):
166166
Paramters
167167
---------
168168
169-
data: af.Array.
169+
line: af.Array.
170170
A 2 dimensional array containing (X,Y,Z) co-ordinates.
171171
172172
title: str.
173173
Title used for the plot.
174174
"""
175175
_cell = _Cell(self._r, self._c, title, self._cmap)
176-
safe_call(backend.get().af_draw_plot3(self._wnd, data.arr, ct.pointer(_cell)))
176+
safe_call(backend.get().af_draw_plot3(self._wnd, line.arr, ct.pointer(_cell)))
177177

178178
def surface(self, z_vals, x_vals, y_vals, title=None):
179179
"""

examples/graphics/plot3.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/python
2+
3+
#######################################################
4+
# Copyright (c) 2015, ArrayFire
5+
# All rights reserved.
6+
#
7+
# This file is distributed under 3-clause BSD license.
8+
# The complete license agreement can be obtained at:
9+
# http://arrayfire.com/licenses/BSD-3-Clause
10+
########################################################
11+
12+
import arrayfire as af
13+
import math
14+
15+
af.info()
16+
17+
ITERATIONS = 200
18+
POINTS = int(10.0 * ITERATIONS)
19+
20+
Z = 1 + af.range(POINTS) / ITERATIONS
21+
22+
win = af.Window(800, 800, "3D Plot example using ArrayFire")
23+
24+
t = 0.1
25+
while not win.close():
26+
X = af.cos(Z * t + t) / Z
27+
Y = af.sin(Z * t + t) / Z
28+
29+
X = af.maxof(af.minof(X, 1), -1)
30+
Y = af.maxof(af.minof(Y, 1), -1)
31+
32+
Pts = af.join(1, X, Y, Z)
33+
win.plot3(Pts)
34+
t = t + 0.01

0 commit comments

Comments
 (0)