
Calling Sequence


getdata(p, opts)


Parameters


p



a PLOT, PLOT3D or _PLOTARRAY structure

opts



(optional) the element option as described below





Options


•

element : "curve", "grid", "mesh", "points", "polygon", "all" (default), or a list containing any of these

•

includecolor : boolean indicating that color information should be returned; default is false.

•

rangesonly : boolean indicating that only a list of ranges for the entire plot should be returned; default is false.



Description


•

The getdata command retrieves data from a plot structure and returns it in the form of a Matrix or an Array, along with the ranges of the data.

•

For each element in a single 2D or 3D plot (such as a curve or a polygon), a list is returned. Each list contains a string to identify the type of element, a list of $d$ ranges, where $d$ is the plot dimension, and the data itself.

•

If p is a _PLOTARRAY structure, then a Matrix is returned. The ($i$, $j$)th element of this Matrix contains the data corresponding to the ($i$, $j$)th plot in the plot array. Note that when the the plot array consists of a single row or column, a Matrix is still returned, with one of its dimensions equal to 1.

•

For curves, points and polygons, the data is returned as an $n$ by $d$ Matrix, in which each row consists of the coordinates for one of the $n$ points defining the element. For a grid, the data is returned as an $m$ by $n$ Matrix, containing the $z$ values corresponding to an $m$ by $n$ grid of points evenly spaced over the $x$$y$ region defined by the ranges. For a mesh, the data is returned as a 3dimensional $m$ by $n$ by 3 Array A, where A[i,j] gives the 3 coordinate values of the (i,j)th point on the $m$ by $n$ mesh.

•

The element=t option allows you to restrict the returned results to the type of plot elements specified in the value t.

•

If the rangesonly option is set to true, then only a list of ranges for the entire plot is returned.

•

If the includecolor option is set to true, then color information is returned in the form of a list. The first entry of the list is a string indicating the color space, and the second is an Array containing the color data as described on the plot/structure help page. Note that local color information associated with a single plot element is returned with the other data for that element, inside the same sublist. Global color information that applies to the entire plot is returned as an additional item in the sequence of return values. If there is no color information associated with a plot element or with the entire plot, then an empty list appears where the color information would normally be found.

•

Note that, for 2D density plots generated from the plots:densityplot command, getdata returns the information for the associated grid or mesh structure, but the data of interest resides in the color rtable obtained via the includecolor option.

•

The getdata command does not work with animations, and it does not return data for text or isosurface elements.



Examples


>

$\mathrm{with}\left(\mathrm{plottools}\right)\:$

>

$\mathrm{p1}\u2254\mathrm{plot}\left(\mathrm{sin}\left(x\right)\,x=0..\frac{\mathrm{\pi}}{2}\right)\:$

>

$\mathrm{p2}\u2254\mathrm{plots}:\mathrm{polygonplot}\left(\mathrm{Matrix}\left(\left[\left[0\,0\right]\,\left[0\,1\right]\,\left[0.5\,0.5\right]\,\left[1\,1\right]\,\left[1\,0\right]\right]\,'\mathrm{datatype}'='\mathrm{float}'\right)\,'\mathrm{color}'=''Blue''\right)\:$

>

$p\u2254\mathrm{plots}:\mathrm{display}\left(\mathrm{p1}\,\mathrm{p2}\right)\:$$p$

>

$\mathrm{getdata}\left(p\,'\mathrm{includecolor}'\right)$

>

$\mathrm{getdata}\left(p\,'\mathrm{element}'=''curve''\right)$

>

$\mathrm{getdata}\left(p\,'\mathrm{rangesonly}'\right)$

$\left[{0.}{..}{1.57079632364999999}{\,}{0.}{..}{1.}\right]$
 (3) 
>

$\mathrm{getdata}\left(\mathrm{plot3d}\left(\mathrm{sin}\left(x+y\right)\,x=1..1\,y=1..1\right)\right)$



Compatibility


•

The plottools[getdata] command was introduced in Maple 15.

•

The plottools[getdata] command was updated in Maple 18.

•

The includecolor option was introduced in Maple 18.




