Documentation
Visualizing data

## Matrix Interface: Surface plot of 2D data.

array a(seq(10));
a = tile(a,1,10);
//a = 10 columns, each containing numbers 0-9
Parameters
 [in] X 2D matrix with which to draw simple surface plot
handle surface (const af::array &X)

## Matrix Interface: Visualize 2D velocity field with an array of arrows

array a(seq(10));
//create arrows along the diagonal
//the arrows rotate around the unit circle
arrows(a,a, cos(a), sin(a));
// using existing 2D flow matrices u,v
// ...
// create x,y map for indexing
array xx = tile(array(seq(u.dims(1))).T(),u.dims(0),1);
array yy = tile(array(seq(v.dims(0))),1,v.dims(1));
// draw 2D flow field
arrows(xx,yy,u,v);
Parameters
 [in] X0,Y0 coordinates of points from which to draw [in] X1,Y1 coordinates of points to which to draw
Note
this function does not work on OSX yet, due to lack of certain OpenGL shader support
handle arrows (const af::array &X0, const af::array &Y0, const af::array &X1, const af::array &Y1)

## Matrix Interface: Visualize 1D data as a line plot

Parameters
 [in] X matrix containing data to be visualized [in] linestyle optional string indicating desired characteristics of plot
Note
valid options for linestyle:
--Plot*--
b     blue
g     green
r     red
c     cyan
m     magenta
y     yellow
k     black
w     white
handle plot2 (const af::array &X)

handle plot2 (const af::array &X, const char *linestyle)

## Matrix Interface: Visualize 2D data as a line plot

Parameters
 [in] X matrix containing horizontal data to be visualized [in] Y matrix containing vertical data to be visualized [in] linestyle optional string indicating desired characteristics of plot
Note
valid options for linestyle:
--Plot*--
b     blue
g     green
r     red
c     cyan
m     magenta
y     yellow
k     black
w     white
handle plot2 (const array &X, const array &Y)

handle plot2 (const array &X, const array &Y, const char *linestyle)

## Matrix Interface: Visualize 3D data as scatter plot

array a(seq(10));
array b = a + randu(10);
plot3(a,b,a);
Parameters
 [in] X matrix containing X data to be visualized [in] Y matrix containing Y data to be visualized [in] Z matrix containing Z data to be visualized
handle plot3 (const af::array &X, const af::array &Y, const af::array &Z)

## Matrix Interface: Visualize 3D data volume

array a( seq( 0, 0.1, 1 ) );
a = tile(a, 1, 10, 10);
//a is symmetric in the y and z dimensions and increases along the x dimension
volume(a);
Parameters
 [in] X 3D array to be volume rendered
handle volume (const af::array &X)

## Matrix Interface: Visualize 2D data as single scale image

If matrix is 3D (last dimension size is 3), it is treated as a color image with red, green, blue channels.

array a(seq(10));
a = tile(a,1,10);
a += a.T();
image(a);
Parameters
 [in] X 2D matrix to be visualized
Note
Automatically scales palette based on min/max values
handle image (const af::array &X)

## Display a figure window

Note
see Usage for available commands
see Color Palettes for available color schemes
handle fig (const char *key, const char *val=NULL)

## Create figure with tiled layout.

handle fig (const char *key, int nx, int ny, int i)

## Display the current figure with given geometry

Parameters
 [in] x The horizontal position of the upper left corner of the figure [in] y The vertical position of the upper left corner of the figure [in] w The width of the figure [in] h The height of the figure
handle fig (int x, int y, int w, int h)

## Function Documentation

 handle af::surface ( const af::array & X )
 handle af::arrows ( const af::array & X0, const af::array & Y0, const af::array & X1, const af::array & Y1 )
 handle af::plot2 ( const af::array & X )
 handle af::plot2 ( const af::array & X, const char * linestyle )
 handle af::plot2 ( const array & X, const array & Y )
 handle af::plot2 ( const array & X, const array & Y, const char * linestyle )
 handle af::plot3 ( const af::array & X, const af::array & Y, const af::array & Z )
 handle af::volume ( const af::array & X )
 handle af::image ( const af::array & X )
 handle af::fig ( const char * key, const char * val = NULL )
 handle af::fig ( const char * key, int nx, int ny, int i )
 handle af::fig ( int x, int y, int w, int h )