Plotting with ILNumerics.Net - Getting Started

Libraries to be referenced

The main assembly to be referenced in your project is named 'ILNumerics.Drawing.dll'. After downloading the Core Module and ILNumerics.Drawing Module, it resides in the main ILNumerics.Net bin/ folder. All files further needed are also included in the runtime distributable zip-package and should get distributed with your application. All library dependencies are listed in the following table. Some of them should already be installed on your system, some are distributed with ILNumerics.Net. All libraries marked as 'necessary' should exist in the same folder as ILNumerics.Drawing.dll. Only the main libraries (ILNumerics.Net.dll and ILNumerics.Drawing.dll) must be referenced in your projects.

Librarypurposenecessary/ optionalget from...
ILNumerics.Net.dllILNumerics.Net main core modulenecessaryCore Module
ILNumerics.Drawing.dllmain plotting assemblynecessaryILNumerics.Drawing Modules
OpenTK.dllOpenGL bindingsnecessaryILNumerics.Drawing Modules
OpenTK.Utilities.dllOpenGL helpernecessaryILNumerics.Drawing Modules
ILNumerics.DrawingD3D.dllDirectX classes
(alpha state, deprecated)
optional on windowsILNumerics.Drawing Modules
OpenGL driverOpenGL driver (platform dependent)necessary, installed with OSpreinstalled with OS/ vendor driver

Namespaces to include

All visual objects are found in the ILNumerics.Drawings namespace and its subnamespaces. The most important namespaces are:

ILNumerics.Drawingsmain plotting namespace, contains all basic classes and definitions (enums) handling and configuring plotting objects
ILNumerics.Drawings.ControlsContains all controls directly and indirectly used by ILNumerics.Net plot controls.
ILNumerics.Drawings.GraphsDefines all graph types. Currently 2D and 3D graphs are available. This is needed, to access and configure the graph objects returned from any plot controls.
ILNumerics.Drawings.TextRendererDefines classes capable of drawing text into graphical output.

Availability on mono

The plot controls have been tested and confirmed to run on mono 1.2.6. (Windows and Linux). Earlier versions of mono are unlikely to work correctly.

Simple plotting example

In this example we will create a very simple 2D plotting window. It will demonstrate how to setup the environment and to instantiate a simple ILFigure window to draw numeric data contained as columns in a matrix. Like most examples (if not all) on this website, it is expected, to use Microsoft Visual Studio 2005 and C# as programming language. On later versions the steps to reproduce the examples may differ. At the end of each example a link provides the example's source code and a built ready VS2005 solution.

  1. Open VS2005 and create a new "Windows Application" project. A new System.Windows.Forms formular 'Form1' will be created by default.
  2. On your filesystem, place the following ILNumerics.Net libraries into the auto-generated bin/Debug folder below your project path. The files should have been obtained from the latest runtime distributable package of ILNumerics.Net from the download section of our website.
    • ILNumerics.Net.dll
    • ILNumerics.Drawing.dll
    • OpenTK.dll
    • OpenTK.Utilites.dll
    Since we are not dealing with sophisticated mathematical functions here, no further references to Lapack libraries etc. are needed by now.
  3. In VS2005 include references to ILNumerics.Net.dll and ILNumerics.Drawing.dll to your project. Browse these libraries in your 'bin/Debug/ folder'.
  4. Double click on the newly created form. The form designer auto generated code pops up showing the Form1_Load event handler.
  5. At the beginning of the Form1 code file, include references to necessary namespaces:
    using ILNumerics;
    using ILNumerics.Algorithms;
    using ILNumerics.Drawing.Controls;
  6. Insert the following code snippet into the function body of the Form1_Load event handler stub:
    // create sine and cosine test data: 61 samples, 2 periods
    ILArray<double> data = ILSpecialData.sincos1D(61,2.0);
    // create an ILFigure plot dialog
    ILFigure ilfigure1 = new ILFigure(); 
    // add the data as Plot2D graph
    ilfigure1.ActiveSubfigure.Panel.Graphs.AddPlot2DGraph(data);
    // set the size
    ilfigure1.Size = new Size(740,500); 
    // set the title 
    ilfigure1.ActiveSubfigure.Title.Text = "Example1 - simple ILFigure"; 
    ilfigure1.ShowDialog();
  7. Compile and run the solution. You should see a form similar to this one:

Download this example as VS2005 solution package (no binaries)

The next chapters will examine the graphical controls in more detail. The class hirarchy will be presented along with the possibilities to create and configure different graph types.


Valid CSS! Valid XHTML 1.0 Transitional