Surface graphs
Surface graphs visualize numeric, two dimensional data in 3 dimensional plots. The position of each datapoint is determined by the position of the corresponding data in the matrix.
The height of the point corresponds to the value of the point. Adjacent points are connected by colored areas (surfaces). The whole set of those areas models a surface representing the height map of the matrix. To increase the clearness, data points are colored according to their heigths. The colormap used spreads from red (maximum value) to blue (minimum value).
The left picture shows the famous 'sinc' function in a very low resolution. In order to reproduce that surface, one can use the example project here. All demos in this section will be based on that example too.
In ILNumerics.Net surface graphs are represented by the class ILSurfaceGraph.
Those graphs can be created by the instance member of ILPanel.Graphs.AddSurfGraph(ILBaseArray).
A new instance of ILSurfaceGraph is added to the collection of existing
graphs and also returned for further configuration.
Surface graphs can be configured in a very flexible way. They are composed out of
- wireframes, connecting adjacent points lying on the same row and/or column, and
- filled areas, filling the rectangles between the wireframes.
Wireframe configuration
Wireframe properties are accessed via the ILSurfaceGraph.Wireframe
member of surface graphs. They are configured in the same way as most lines for
ILPanel. The properties of wire lines are instances of ILLineProperties,
which has been described in the section for line graphs
already.
In addition to the common line properties, colors for wireframes can be set in a
special way. If the ILSurfaceGraph.Wireframe.Color property is set
to Color.Empty, the color of the lines will reflect the color corresponding
to the height of the point. The following plots will make this clear.
Sinc function as wireframe only.
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.Black;
sg.Filled = false;
Sinc wireframe colors corresponding to height.
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.Empty;
sg.Filled = false;
Surface area configuration
The filled area between wireframes is configured by following properties of ILSurfaceGraph
instances:
| Property | Type | Description |
|---|---|---|
Filled | bool | Switch the visibility for filled areas on/off. |
Opacity | float | Opacity for filled areas. Range: 0.0f to 1.0f. 0.0f means fully transparent, 1.0f means fully opaque. |
Shading | ShadingStyles | ShadingStyles.Flat: areas are solid colored. The color is determined from the average of the heights of neighboring points. ShadingStyle.Interpolate: The colors on the areas is interpolated from the colors determined from the heights of neighboring points. |
Opacity example
Translucent sinc function: Opacity set to 0.2f
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.LightBlue;
sg.Opacity = 0.2f;
Opacity set to 0.9f
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.LightBlue;
sg.Opacity = 0.9f;
Shading example
Sinc function with shading set to Flat
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.DarkSlateBlue;
sg.Shading = ShadingStyles.Flat;
Sinc function with shading set to Interpolate
ILSurfaceGraph sg;
sg = (ILSurfaceGraph)panel.Graphs[0];
sg.Wireframe.Color = Color.DarkSlateBlue;
sg.Shading = ShadingStyles.Interpolate;