2D line graphs

Line graphs are provided by the ILPlot2DGraph class. They are used to visualize vector sized data. Each vector results in a individual ILPlot2DGraph instance to be added to the ILPanel.Graphs collection. Line graphs are created by the function ILPanel.Graphs.AddPlot2DGraph(ILBaseArray data), where data is any numeric ILArray.

Line graphs are configured in various ways. Refer to the left image, which displays common elements of a single ILPlot2DGraph. The graph is composed out of a red line connecting the data points and black markers emphasizing those datapoints.

The most important properties for ILPlot2dGraph objects are therefore:

  • Line, and
  • Marker.


Line properties

The line of an ILPlot2dGraph is realized and described by a class called ILLineProperties. Lines can get configured in a very flexible way. The following table gives an overview.

Most lines in ILPanel are represented by ILLineProperties and can be configured this way. Examples are the grid lines for axis or the axis bounding box lines.
Line Property Description
Antialiasing Draw the line smoothed. This works best for line width ≥ 2
Color Line color
Style Sets the pattern for the line to some predefined value.
Pattern Specifies a user defined stipple pattern.
PatternScale Stretch or shrink the pattern by a factor.
Visible Switch the visibility for the line on/off.
Width Line width.

Marker properties

The implementation is not completed yet. Currently only marker styles None, Dotand Square are supported. More marker types are on top of the roadmap.Since the implementation is not very hard, we expect them for the next release.

Markers are used to emphasize data points and to distinguish them among other graphs. Markers can be configured independantly from the line of each ILPlot2DGraph object.

Marker Property Description
Bitmap (Not yet implemented) Defines the bitmap to be used as marker, if Style is set to Bitmap.
Color Color for markers
Size Size of Markers (default: 4)
Style Set marker style to some predefined values. Default: None. Currently implemented are also: Dot and Square.

Handling multiple line graphs

ILPanel.Graphs.AddPlot2DGraph() creates graphs for the columns of data array given. If more than one column is provided, each column will result in an individual line graph. The line colors for all graphs created will automatically rotated according to the KnownColors enumeration. The graphs are than returned as an array of ILPlot2DGraph[]. Each graph in the array corresponds to a column in the data array in the order given.

Line plotting example

This example creates an ILFigure to plot 3 line graphs at once. The array of created graphs returned is than used to set some properties for the graphs.

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing; 
using ILNumerics; 
using ILNumerics.Algorithms; 
using ILNumerics.Drawing; 
using ILNumerics.Drawing.Controls; 
using ILNumerics.Drawing.Graphs; 
using System.Windows.Forms; 


namespace ExampleA {
class Program : ILNumerics.Algorithms.ILAlgorithm {
    static void Main(string[] args) {
        ILFigure fig = new ILFigure(); 
        fig.Width = 600; 
        ILPanel panel = fig.ActiveSubfigure.Panel; 
        ILArray<double> data = rand(1,50) * 0.6 +linspace(-2,4,50);
        data["1,2;:"] = ILSpecialData.sincos1D(100,2.0f).T[":;0:49"];
        ILPlot2DGraph[] graphs2D = panel.Graphs.AddPlot2DGraph(data.T); 
        // additional configurations go here
        graphs2D[0].Marker.Style = MarkerStyle.Dot; 
        graphs2D[2].Line.Color = Color.Red;
        fig.ShowDialog(); 
    }
}
}

Download the complete example project as VS2005 solution here.


Valid CSS! Valid XHTML 1.0 Transitional