Intensity Charts and GraphsColor as a Third Dimension


So what do you do if you want to plot three variables against each other, instead of just two? If you're using Windows, you can use the ActiveX 3D Graph Controls, which we'll discuss next.

On all versions of LabVIEW, you can also make an intensity plot. Intensity charts and graphs display three dimensions of data on a 2D plot by using color to display values of the third dimension of data (the "Z" values). Like the waveform chart, the intensity chart features a scrolling display, while the intensity graph display is fixed. Intensity plots are extremely useful for displaying patterned data such as terrain, where color represents altitude over a two-dimensional area, or temperature patterns, where color represents temperature distribution (see Figure 8.49).

Figure 8.49. Intensity Graph (top) and Intensity Chart (bottom), which display color as a third dimension


Intensity plots function much like two-dimensional charts and graphs in most ways, with the addition of color to represent the third variable. A color scale is available so you can set and display the color mapping scheme. Intensity graph cursor displays also include a Z value.

Intensity charts and graphs accept 2D arrays of numbers, where each number in the array is a color value. The indices of each array element represent the plot location for that color. Not only can you define the mapping of numbers to colors using the color scale (which works like a color ramp, if you've played with that), but you can also do it programmatically using property nodes (Chapter 12, "Instrument Control in LabVIEW," will tell you all about them). The simple example in Figure 8.50 shows a 3 x 4 array plotted on an intensity graph. The colors mapped are blue (1.0), green (2.0), and red (3.0).

Figure 8.50. An intensity graph displaying a 2D array of intensity values as colors


To assign a color to a value on the color scale, pop up on the corresponding marker and select Marker Color>> ("markers" are the numeric displays on the Z scale legend). The Z scale of intensity charts and graphs has Arbitrary Marker Spacing by default, so you can alter the "gradient" of colors by dragging a marker with the Operating tool. Create new markers by selecting Add Marker from the Color Scale pop-up menu, and then drag them to a desired location and assign a new color. If you want to learn more about intensity charts and graphs, we suggest playing around with them. You can also look in LabVIEW's online documentation for more exact instructions.

Activity 8-5: The Intensity Graph

In this activity, you will look at a VI that displays wave interference patterns. This VI will also show you how the intensity graph maps its input 2D array to the display.

1.

To get an idea of how intensity graphs and charts work, open the Intensity Graph Example VI, located in the EVERYONE\CH8 directory. Run the VI. You will see an intricate interference waveform plotted on the graph (see Figure 8.51). The color range is defined in the block diagram using the intensity graph attribute node. Modify the color range by clicking on the color boxes in the first frame of the Sequence Structure with the Operating tool, and then choosing a new color from the palette that appears. Run the VI again.

Figure 8.51. Intensity Graph Example.vi front pane after running in "Wave Interference Plot" mode


2.

Switch the Display switch to Simple User Array and enter values between 0.0 and 10.0 in the User Array control (the color range for the graph has been defined in the block diagram using the intensity graph property nodeblue (0.0) to red (10.0)). After you enter all the values, run the VI. Notice how the magnitude of each element is mapped to the graph. Now change your values and run it again (see Figure 8.52).

Figure 8.52. Intensity Graph Example.vi front panel after running in "Simple User Array" mode


3.

Take a look at the block diagram to see how the VI works.

4.

Close the VI and don't save any changes.

For more examples of intensity plots, open some of the VIs that ship with LabVIEW in examples\general\graphs\intgraph.llb. You can also check out Simulation of Tomography and Heat Equation Example in examples\analysis\mathxmpl.llb (see Figure 8.53).

Figure 8.53. Simulation of Tomography.vi front panel


3D Graphs

For true three-dimensional graphs, LabVIEW for Windows[1] Professional Version offers a 3D Surface Graph, 3D Parametric Graph, and 3D Curve Graph from the Graph palette.

[1] If you're a Mac or Linux user and feel left out, let National Instruments know you'd like this feature across all platforms.

These 3D graphs are only for Windows, and are not present in the Base package of LabVIEW.


Figures 8.54 and 8.55 show a VI's front panel and block diagram that presents an example of a "doughnut"called a torusplotted on the 3D Parametric Graph control. Unlike the previous charts and graphs you've seen, 3D graphs don't have a simple block diagram terminal; they actually use special subVI functions that are automatically created when you drop a 3D graph on the front panel. (You can find the Torus.vi in the LabVIEW examples, using the NI Example Finder.)

Figure 8.54. Torus.vi front panel showing a 3D toroidal "doughnut" surface plot . . . mmmm doughnuts!


Figure 8.55. Torus.vi block diagram


The three types of 3D graphs can all plot in three dimensions, but each one works slightly differently:

A 3D Surface Graph plots a simple surface from the z matrix (see Figure 8.56). The surface is modified by the x and y vectors that cause the surface to shift in relation to the x and y planes. It accepts one 2D array and the two optional 1D arrays.

Figure 8.56. 3D Surface Graph


3D Parametric Surface plots a surface in terms of x, y, and z surfaces (see Figure 8.57). It takes in three 2D arrays or matrices that specify each of the x, y, and z planes.

Figure 8.57. 3D Parametric Surface


3D Curve describes a line in terms of x, y, and z points (see Figure 8.58). This VI has three 1D arrays or vectors inputs that specify each point in the plot.

Figure 8.58. 3D Curve


3D graphs can be more complicated than the simple charts and graphs you've worked withthey are really an advanced topic, so we won't say more about them here; we just wanted to let you know they are there if you need them. You can browse LabVIEW's 3D graph examples to get an idea of how to use them.

These 3D graphs are ActiveX controls and contain more functionality than is exposed by the 3D graph VIs. As you will learn in Chapter 16, "Connectivity in LabVIEW," you can use property and invoke nodes to access these additional properties and methods.





LabVIEW for Everyone. Graphical Programming Made Easy and Fun
LabVIEW for Everyone: Graphical Programming Made Easy and Fun (3rd Edition)
ISBN: 0131856723
EAN: 2147483647
Year: 2006
Pages: 294

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net