Retrieving Plot Data
Each plot is made up of one or more groups or parts. Most plots contain only one group, such as Surface (Plot) or Line plots, whereas for example Slice plots contain one group per slice. Retrieve the number of groups with the method
plot.getGroups(<renderIndex>)
where plot is any plot feature.
Retrieving the groups requires that you specify a render index for which you want the number of groups. Each plot is made up of one or more internal, or rendering, plot types. For example, particle tracing can contain both lines and spheres, which are separate rendering types. Most plot have only a single rendering type, in which case you can safely use 0 as the render index. The group index property indicates groups or parts within the rendering group index.
Extract the data contained in any plot feature using the following methods:
p = plot.getVertices(<renderIndex>, <groupIndex>) returns a float matrix containing one row for each dimension and one column for each vertex.
t = getElements(<renderIndex>, <groupIndex>) returns the indices to columns in p of a simplex mesh, each column in t representing a simplex.
d = getData(<renderIndex>, <groupIndex>, <dataType>) returns a float array containing the data for each point in p. The type of data to retrieve is given by the String <dataType>:"Color", "Height", and so forth.
To retrieve the available data types, use:
types = getDataTypes(<renderIndex>)
which returns a string array with the data types currently present in the plot.
For plot features, you can retrieve the point normals using the following method:
n = getNormals(<renderIndex>, <groupIndex>)
which returns a floating-point matrix of point normals with each column corresponding to a single vertex.
Example
int renderDataGroups = plot.getRenderGroups();
 
for (int ri = 0; ri < renderDataGroups; ri++) {
 
   String[] dataTypes = plot.getDataTypes(ri);
   int plotDataGroups = plot.getGroups(ri);
   for (int gi = 0; gi < plotDataGroups; gi++) {
      p = plot.getVertices(ri,gi);
      t = plot.getElements(ri,gi);
      //d = plot.getData(ri, gi, "Color");
      d = plot.getData(ri, gi, dataTypes[0]);
   }
}
Retrieving Axis Units
Use model.result(<feature>).getAxisUnits() to return the units of the coordinate axes for the plot group to which the feature belong; null for 1D plot groups. This method returns a string array of length 2 or 3 containing LaTeX-formatted units.
Retrieving Colors
The following methods are available for plot groups and plots:
double[] color = plot.getColor(<propertyname>,<useGraphicsTheme>)
double[] color = plot.getColor(<propertyname>,<colortheme>)
The return value is an array with the RGB values of the color.
The property name must be a property that defines a color. If the string value of the property is fromtheme, the color will be evaluated using the theme. If the string value is an explicit color, the RGB values for that color will be returned. In that case, the theme is not relevant.
In the first method, if <useGraphicsTheme> is set to true, it means that the model’s graphics color theme will be used, and if it is set to false, it means that the model’s image export color theme will be used.
Using the second method, you can specify the color theme to use, ignoring the model’s theme.