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 PlotCube. 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:
- 2D- versus 3D-Mode
- Clipping
- Plot Cube Mouse Interaction, rotation modes
- Programmatic View Configuration
- → Aspect Ratio Mode
Plot Cube Overview
Plots in ILNumerics are based on a special plot container within the common scene graph. Commonly, objects like lines, filled areas, surface plots etc. are displayed in a measurable and interactive plotting cube. The plot cube provides X,Y and Z-axes for measuring distances, 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 can be imagined as 'being watched' by a camera object. Therefore, we add our plot cube right to the scene of our panel – as a new camera-like object:
2D- versus 3D- Mode
Two fundamentally different modes exist to plot cubes: 2D and 3D mode.
- 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. By default, plot cubes created in 2D mode use the full rendering area by stretching its content and using as much space as possible (see: aspect ratio).
- 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. A plot cube created for 3D mode will by default try to maintain the aspect ratio of its content (see: aspect ratio).
The mode is set in the constructor or by the PlotCube.TwoDMode property:
After creation the mode may be controlled by setting PlotCube.TwoDMode. false switches to 3D mode.
true switches back to 2D mode.
The default value for PlotCube.TwoDMode is true. Make sure to select the appropriate mode for your content.
Clipping
Plot cube utilizes 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 becomes clipped.
Clipping can be deactivated by setting PlotCube.Plots.Clipping = null.
By default clipping is activated. Since the setting of the clipping parameters always follows interactive zoom and pan operations, individual user settings would be overwritten silently during such interactions. In order to configure permanent custom clipping planes within a plot cube, place your content into your own group node inside PlotCube.Plots and use the Clipping property of the new group for custom clipping planes (See: clipping).
Plot Cube Mouse Interaction
Full mouse interaction is supported in both, 2D and 3D mode for interactive panels (Panel in Windows.Forms). The mouse is used to manipulate the following settings:
- The visiable limits as ranges in X, Y and Z, corresponding to Zoom In/Out and Panning.
- The rotation angle 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 / Right Drag | Restrict dragging to X or Y direction | -- |
Left Double Click | Reset to default view | 3D Camera: reset to default view; PlotCube: -- |
Note, that a plot cube in 3d mode has no default view. However, one can easily register a custom mouse event to implement arbitrary behavior. See: mouse events for more details.
In order to have a plot cube reset its rotation and panning to the initial view, the following mouse event can be used:
Rotation Methods
- PlotCube.RotationMethod = RotationMethods.EulerAngles (default) The plot cube is rotated along arbitrary axes. This method mimics the look and feel of rotating a large ball on a water surface. It is known from other popular viewers, like Google Earth and is the standard rotation method in ILNumerics since version 3.0.
- PlotCube.RotationMethod = RotationMethods.AltitudeAzimuth Rotation is limited to spherical coordinates: the plot cube can be rotated along the two coordinates azimuth and altitude. Note, that not all rotations can be realized this way. But this methods is more simple and sometimes easier to handle then 'EulerAngles'. This method is available for PlotCube since version 6.
Enable / Disable User Interaction
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.
Use mouse events to implement your own scene modifications when finer control over user interactions is required.
Programmatic View Configuration
The same configurations which can be achieved by mouse interaction can be done programmatically. Other than for the 3D Camera 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 PlotCube.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 PlotCube.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 PlotCube.Rotation.
Here, the PlotCube.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.
Aspect Ratio Mode
(Updated, version 6) This content has moved. See here.