[python-arrayfire] 223/250: FEAT: Adding new graphics functions from 3.3

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Mon Mar 28 22:59:51 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 2e951d1e72c82ff210b0b4d035264524c5a6c676
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Wed Mar 2 14:51:23 2016 -0500

    FEAT: Adding new graphics functions from 3.3
---
 arrayfire/graphics.py | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 arrayfire/library.py  | 13 +++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/arrayfire/graphics.py b/arrayfire/graphics.py
index b1b4f82..0597b83 100644
--- a/arrayfire/graphics.py
+++ b/arrayfire/graphics.py
@@ -140,6 +140,46 @@ class Window(object):
         _cell = _Cell(self._r, self._c, title, self._cmap)
         safe_call(backend.get().af_draw_image(self._wnd, img.arr, ct.pointer(_cell)))
 
+    def scatter(self, X, Y, marker=MARKER.POINT, title=None):
+        """
+        Renders input arrays as 2D scatter plot.
+
+        Paramters
+        ---------
+
+        X: af.Array.
+             A 1 dimensional array containing X co-ordinates.
+
+        Y: af.Array.
+             A 1 dimensional array containing Y co-ordinates.
+
+        marker: af.MARKER
+             Specifies how the points look
+
+        title: str.
+             Title used for the plot.
+        """
+        _cell = _Cell(self._r, self._c, title, self._cmap)
+        safe_call(backend.get().af_draw_scatter(self._wnd, X.arr, Y.arr,
+                                                marker.value, ct.pointer(_cell)))
+
+    def scatter3(self, P, marker=MARKER.POINT, title=None):
+        """
+        Renders the input array as a 3D Scatter plot.
+
+        Paramters
+        ---------
+
+        P: 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_scatter3(self._wnd, P.arr,
+                                                 marker.value, ct.pointer(_cell)))
+
     def plot(self, X, Y, title=None):
         """
         Display a 2D Plot.
@@ -255,6 +295,16 @@ class Window(object):
         safe_call(backend.get().af_is_window_closed(ct.pointer(tmp), self._wnd))
         return tmp
 
+    def set_visibility(is_visible):
+        """
+        A flag that shows or hides the window as requested.
+
+        Parameters
+        ----------
+        is_visible: Flag specifying the visibility of the flag.
+        """
+        safe_call(backend.get().af_set_visibility(self._wnd, is_visible))
+
     def __getitem__(self, keys):
         """
         Get access to a specific grid location within the window.
diff --git a/arrayfire/library.py b/arrayfire/library.py
index 936b840..ea0e90f 100644
--- a/arrayfire/library.py
+++ b/arrayfire/library.py
@@ -315,6 +315,19 @@ class BACKEND(_Enum):
     CUDA    = _Enum_Type(2)
     OPENCL  = _Enum_Type(4)
 
+class MARKER(_Enum):
+    """
+    Markers used for different points in graphics plots
+    """
+    NONE       = _Enum_Type(0)
+    POINT      = _Enum_Type(1)
+    CIRCLE     = _Enum_Type(2)
+    SQUARE     = _Enum_Type(3)
+    TRIANGE    = _Enum_Type(4)
+    CROSS      = _Enum_Type(5)
+    PLUS       = _Enum_Type(6)
+    STAR       = _Enum_Type(7)
+
 def _setup():
     import platform
     import os

-- 
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