ILNumerics - Technical Computing Tools

High Performance Framework for Visualization

and Computing in Industry and Science

 

tgt

Plot Cube Properties

Plotting is used to visualize all kinds of data for purposes like data exploration, charting, scientific visualization and so on. Plotting in ILNumerics is fully based on the ILNumerics scene graph implementation. This offers the user full flexibility to create and customize any plot (make sure to have read the Quick Start Guide).

This tutorial details the properties of the general plot cube container ILPlotCube. The configuration of axis and further options for enhancing plots and charts are explained, including legends, colorbars and annotations.

On this page, you'll learn more about:

 

Plot Cube Overview

Plots in ILNumerics are based on a special plot container within the common scene graph. Commonly, object like lines, filled areas, surface plots a.s.o are expected to ‚live‘ in some kind of measurable and interactive plotting cube. The plot cube provides X,Y and Z-axes for measuring distances, it allows the scaling and labeling of the plots and user interaction like zoom, rotation and pan. The plot cube therefore provides the ‚world‘, the plots are living in. This world considerable differs from the general ‚world‘ of a 3D scene which is commonly 'watched' by a camera object. Therefore, we add our plotting cube right to the scene of our panel:

 

2D- versus 3D- Mode

Two fundamentally different modes exist to plot cubes: 2D and 3D mode.

  1. 2D mode is optimized for 2D plots: line, 2D scatter plots or 2D contour plots. In 2D mode, the camera watches straight onto the X-Y plane, the Z-axis is hidden and axis labels are optimized for 2D display. For zooming in, a zoom selection rectangle is used.
  2. 3D mode is meant for 3D plots: Surface Plots, 3D scatter plots and 3D contour plots. Full rotation capabilities and the option of perspective / orthographic projection are best applicable here.

The mode is set in the constructor or by the ILPlotCube.TwoDMode property:

Setting ILPlotCube.TwoDMode to false switches to 3D mode.

Setting ILPlotCube.TwoDMode to true switches back to 2D mode.

The default value for ILPlotCube.TwoDMode is true. Make sure to select the appropriate mode for your content!

 

Clipping

Plot cubes utilize the Clipping feature of ILNumerics group nodes in order to prevent the content of the plot cube to get drawn outside of the plotting cube limits. For zooming and panning operations (see: Plot Cube Mouse Interaction ) everything outside the current plot cube limits gets clipped.

Clipping can be deactivated by setting the ILPlotCube.Plots.Clipping = null.

By default, the clipping is activated. Since the setting of the clipping parameters will always follow interactive zoom and pan operations, individual user settings would silently be overwritten. In order to configure custom clipping planes for rendering within a plot cube, place your content into an own group node and use the Clipping property of the new group node for custom clipping planes (See: Clipping in ILNumerics Scene Graphs).

 

Plot Cube Mouse Interaction

Full mouse interaction is supported in both, 2D and 3D mode for interactive panels (ILPanel in Windows.Forms). The mouse is used to manipulate the following settings:

  • The limits of the plot cube range (X, Y and Z) correspond to Zoom In/Out and Panning.
  • The rotation angle of the plot cube relative to the observer.
 
  2D Mode 3D Mode
Left Mouse Drag Zoom selection rectangle Rotate horizontally / vertically
Right Mouse Drag Panning the scene Panning the scene
Mouse Wheel Zoom in / out center of scene Zoom in / out center of scene
SHIFT Key + Left Mouse Drag - 10 times finer dragging
CTRL Key + Left Mouse Drag - Rotate camera around look at direction
ALT Key + Left / Rifht Drag Restrict dragging to X or Y direction Restrict dragging to horizontal or vertical direction
Left Mouse Click Selection Selection
Left Double Click Reset to default view Reset to default view
 

User interaction can be disabled for the plot cube. Three switches are provided for separate configurations to dis-/allow the user to zoom, rotate or pan the plot cube content:

Per default, all switches are set to true, in order to allow all interactions.

 

Programmatic View Configuration

The same configurations which can be achieved by mouse interaction can be done programmatically. Other than for the 3D ILCamera nodes, plot cubes allow the following settings:

  • The limits of the plot cube range (X,Y and Z) correspond to Zoom In/Out and Panning.
  • The rotation angle of the plot cube relative to the observer.

The limits of the plot cube are configured by ILPlotCube.Limits:

The initial coordinate system for 3D mode is the same as for 2D mode: The plot cube shows the X-Y plane, with Z coming out of the screen in positive direction:

Again, the ILPlotCube.Limits get/set the visual limits of the content, which is used for panning and zooming. In addition, the plot cube can be rotated via ILPlotCube.Rotation.

Here, the ILPlotCube.Rotation property is used to turn the cube around the X-axis by 90°:

Arbitrary angles can be realized that way:

Note how the Rotation property expects a Matrix4 value. The Matrix4 struct is of good help for creating such matrices. It provides all helper functions for arbitrary transformations: Rotation, Translation and Scale. Individual transforms are combinable by multiplying their corresponding Matrix4 values. Keep in mind, however, the Rotation property is responsible for the content of the plot cube. It does affect all plots and scene graph nodes which were added to the cube. Is does not affect other supporting shapes for the plot cube: lines, ticks, label and the like.