arrayfire.graphics module

Graphics functions (plot, image, etc).

class arrayfire.graphics.Window(width=1280, height=720, title='ArrayFire')[source]

Bases: object

Class to create the Window object.

Parameters:

width: optional: int. default: 1280.

  • Specifies the width of the window in pixels.

height: optional: int. default: 720.

  • Specifies the height of the window in pixels.

title: optional: str. default: “ArrayFire”.

  • Specifies the title used for the window.

Methods

close() Close the window.
grid(rows, cols) Create a grid for sub plotting within the window.
hist(X, min_val, max_val[, title]) Display a histogram Plot.
image(img[, title]) Display an arrayfire array as an image.
plot(X, Y[, title]) Display a 2D Plot.
plot3(line[, title]) Renders the input array as a 3D line plot.
scatter(X, Y[, marker, title]) Renders input arrays as 2D scatter plot.
scatter3(P[, marker, title]) Renders the input array as a 3D Scatter plot.
set_colormap(cmap) Set the colormap for the window.
set_pos(x, y) Set the position of window on the screen.
set_size(w, h) Set the windo height and width.
set_title(title) Set the title of the window
set_visibility(is_visible) A flag that shows or hides the window as requested.
show() Force the window to display the contents.
surface(x_vals, y_vals, z_vals[, title]) Renders the input array as a 3D surface plot.
close()[source]

Close the window.

grid(rows, cols)[source]

Create a grid for sub plotting within the window.

Parameters:

rows: int.

Number of rows in the grid.

cols: int.

Number of columns in the grid.

hist(X, min_val, max_val, title=None)[source]

Display a histogram Plot.

image(img, title=None)[source]

Display an arrayfire array as an image.

plot(X, Y, title=None)[source]

Display a 2D Plot.

plot3(line, title=None)[source]

Renders the input array as a 3D line plot.

scatter(X, Y, marker=<arrayfire.library.MARKER object>, title=None)[source]

Renders input arrays as 2D scatter plot.

scatter3(P, marker=<arrayfire.library.MARKER object>, title=None)[source]

Renders the input array as a 3D Scatter plot.

set_colormap(cmap)[source]

Set the colormap for the window.

Parameters:

cmap : af.COLORMAP.

Set the colormap for the window.

set_pos(x, y)[source]

Set the position of window on the screen.

Parameters:

x : int.

Pixel offset from left.

y : int.

Pixel offset from top

set_size(w, h)[source]

Set the windo height and width.

Parameters:

w : int

Width if window.

h : int

Height of window.

set_title(title)[source]

Set the title of the window

Parameters:

title : str.

Title used for the current window.

set_visibility(is_visible)[source]

A flag that shows or hides the window as requested.

Parameters:is_visible: Flag specifying the visibility of the flag.
show()[source]

Force the window to display the contents.

Note: This is only needed when using the window as a grid.

surface(x_vals, y_vals, z_vals, title=None)[source]

Renders the input array as a 3D surface plot.