Visualizations
Before diving into the details, you may want to visit the example page.
ILNumerics provides a number of .NET controls to create visual output of mathematical objects. The collection of available plotting styles is still growing. Right now, full featured 2D line plots and several 3D plots are available. Custom plots are easily added by utilizing flexible scene graph components.
Main features:
- The controls integrate seemlessly into Windows.Forms applications. They derive from
Windows.Forms.Control . - The use of OpenGL make them a platform independent hence performant solution for visualization of numeric data. The controls are tested and run on .NET 4.0 and mono 2.6 or higher.
- All plots support interactions like zooming and rotation out of the box.
- Custom controls are easily assembled out of basic shapes and reused as building block for even more complex visualizations.
Getting Started - Plotting with ILNumerics
Simple Plotting Example
This example demonstrates a simple 2D plotting application. Two line graphs are created. A marker is added to one of the lines.
Like most examples (if not all) on this website, Microsoft Visual Studio 2010 and C# are used as programming environment. At the end of each example, the example's source code and a complete VS2010 C# project are provided.
- Create a new "Windows Application (C#)" project. A new System.Windows.Forms formular 'Form1' will be created by default.
- Make sure to reference the ILNumerics binaries as explained in the ILNumerics Getting Started guide.
-
Replace the full content of the code section for the auto generated
Form1.csform with the following code snippet:C# Code 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
using System; using System.Drawing; using System.Windows.Forms; // include ILNumerics namespaces using ILNumerics; using ILNumerics.Drawing; using ILNumerics.Drawing.Graphs; using ILNumerics.Drawing.Plots; namespace Example1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } // a panel is declared as forms attribute ILPanel m_panel; private void Form1_Load(object sender, EventArgs e) { // create a panel m_panel = ILPanel.Create(); // add the panel to the forms Controls collection Controls.Add(m_panel); // create sine and cosine test data: 61 samples, 2 periods ... ILArray<float> data = ILSpecialData.sincos1Df(61, 2.0); // .. and add some noise to one column: data[":;1"] = data[":;1"] + ILMath.tosingle(ILMath.rand(61,1)) // add the data as Plot2D graph ILPlot2DGraph[] lineplot = m_panel.Graphs.AddPlot2DGraph(data); // select marker type for the first line lineplot[0].Marker.Shape = MarkerStyle.Cross; } } }
-
Executing the project should create a form similar to this:
Download this example as VS2010 project
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.