Skip to content

Commit 5e92e72

Browse files
committed
FEAT: Adding graphics functions from arrayfire 3.2
1 parent c0423b7 commit 5e92e72

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

arrayfire/graphics.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,20 @@ def set_colormap(self, cmap):
109109
"""
110110
self._cmap = cmap
111111

112+
def set_size(self, w, h):
113+
"""
114+
Set the windo height and width.
115+
116+
Parameters
117+
-----------
118+
w : int
119+
Width if window.
120+
121+
h : int
122+
Height of window.
123+
"""
124+
safe_call(backend.get().af_set_size(self._wnd, w, h))
125+
112126
def image(self, img, title=None):
113127
"""
114128
Display an arrayfire array as an image.
@@ -145,6 +159,46 @@ def plot(self, X, Y, title=None):
145159
_cell = _Cell(self._r, self._c, title, self._cmap)
146160
safe_call(backend.get().af_draw_plot(self._wnd, X.arr, Y.arr, ct.pointer(_cell)))
147161

162+
def plot3(self, line, title=None):
163+
"""
164+
Renders the input array as a 3D line plot.
165+
166+
Paramters
167+
---------
168+
169+
data: af.Array.
170+
A 2 dimensional array containing (X,Y,Z) co-ordinates.
171+
172+
title: str.
173+
Title used for the plot.
174+
"""
175+
_cell = _Cell(self._r, self._c, title, self._cmap)
176+
safe_call(backend.get().af_draw_plot3(self._wnd, data.arr, ct.pointer(_cell)))
177+
178+
def surface(self, z_vals, x_vals, y_vals, title=None):
179+
"""
180+
Renders the input array as a 3D surface plot.
181+
182+
Paramters
183+
---------
184+
185+
z_vals: af.Array.
186+
A 1 dimensional array containing Z co-ordinates.
187+
188+
x_vals: af.Array.
189+
A 1 dimensional array containing X co-ordinates.
190+
191+
y_vals: af.Array.
192+
A 1 dimensional array containing Y co-ordinates.
193+
194+
title: str.
195+
Title used for the plot.
196+
"""
197+
_cell = _Cell(self._r, self._c, title, self._cmap)
198+
safe_call(backend.get().af_draw_surface(self._wnd,
199+
z_vals.arr, x_vals.arr, y_vals.arr,
200+
ct.pointer(_cell)))
201+
148202
def hist(self, X, min_val, max_val, title=None):
149203
"""
150204
Display a histogram Plot.

0 commit comments

Comments
 (0)