Visualization Considerations (MATLAB)

Why Visualize?

The obvious question that is at the heart of MATLAB graphics is "Why would I ever want to visualize my data?" At its very essence, science is the quest for truth. However, some of those truths are not easily discovered, and in many cases, we don’t even know how to ask the appropriate questions that will lead to the truth. Consider the fact that many natural phenomena are too fast, too slow, too large, or too small to be studied through direct observation or with traditional laboratory techniques. How can we see the unseen or gain enough insight into the nature of things to even know what is worthwhile to investigate? Also, consider that everything humankind has made and every fact that has been discovered were first birthed as an idea, i.e., something with form only in    the mind’s eye. We    revere those who can see    beyond the apparent and    call them    "visionary."    A dictionary will tell us that    to visualize means, "To form a mental image or vision of." Therefore, when we discuss what it means to visualize something with MATLAB or with anything else for that matter, we need to be aware of the significant role the mind plays in this discussion. However, this is a topic about MATLAB, not about philosophy, but it is important that you    realize that what we are really exploring    in this topic are ways to    represent    something,    whether that something is    a graphical representation of a real-world object, a hypothetical mathematical construct, or specific values of some measurable quantities. Most importantly, we want to create those representations in such a way that the human mind can understand them and then ask the right questions that lead to the discovery of new things or to a better understanding of our universe.

So why do you need visualization? Aside from making your boss look good to his superiors, the visualization of your data can help you identify and emphasize areas of interest, such as where significant events occur, or where the data exhibits a curious behavior. It can also help you to convey your thoughts, observations, or conclusions to others in a quick and intuitive way. There are probably as many applications for MATLAB as there are users of it, and every application will have its own special needs, but even amongst all that, a little understanding of some scientific visualization fundamentals will help you achieve the results you desire. Table 2.1.1 lists some of the reasons to visualize your data.

Table 2.1.1 Reasons to Visualize Data

Explore it

Exploit it

Emphasize some aspect of it

Analyze it

Gain new insights into it

Assess or control the quality of it

See "the invisible"

Present it

Publish it

Interact with it

One can easily argue that the need to visualize data and information has, largely, driven our technology. The entire field of computer graphics, which includes hardware and software, is devoted to furthering the science of how we represent and interact with information in effective ways.

Characteristics of Good Data Visualization

MATLAB has established itself as a preeminent computing environment. By computing environment we mean that not only does MATLAB provide the user with quick access to many data processing functions, but also allows a MATLAB programmer to create special purpose applications to be used by "domain specialists." These domain specialists are often not interested in knowing the intricacies of MATLAB programming, but are very interested in having analytical tools that are intuitive to use and in which they can have confidence. Since you are reading this topic, you either have a need for visualizing some of your own data, or you are involved in developing some form of graphical user interface, either for your own analytical efforts, or to support some domain specialists who really don’t want to be programmers.Here we will consider how to better represent data and results so that the salient aspects of the information contained in the data can be readily observed.

In Table 2.1.1 we listed some reasons why you would want to visualize data. Remember, the basic reason for visualization is to help you, or those you work with, solve problems. Cognitive psychologists have demonstrated that the way in which a problem is presented can determine how difficult a problem is to solve, so we "re-present" the problem in more understandable, i.e., intuitive, ways and in doing so gain insight.

Good visualizations must be meaningful; every plotted point, and each colored line needs to help with the intuitive understanding. This leads to issues of perception, and since visualization in the scope of this topic is visual, we are talking about visual perception. This idea of perception has to be distinguished according to two primary areas of intent: 1) the display and communication of data, and 2) the investigation and understanding of data. The direction with which you are approaching your problem will determine largely the manner in which you visualize your data. A good visualization should distill the vast quantity of data, or the difficult-to-understand concept, into quantities and terms that are readily understandable. It is by comparison to what we know that we discover what we don’t know. It is much easier to see an anomalous spike in data when it is plotted, as opposed to looking at a list of numbers on a printout. The modern scientific world is not a simple world. We have developed the scientific tools we have in order to investigate and communicate in unambiguous terms. In this communication, we must strive for clarity, precision, and efficiency. Table 2.2.1 lists some characteristics of good data visualizations.*

Table 2.2.1 Characteristics of Good Visualizations

A Good Visualization Should…


Serve a clear purpose.

We are interested in describing, exploring, or recording something.

Show the data without distorting it.

The data is what is important, or more fundamentally, the truth the data reveals.

Cause the viewer to think about the substance of the data.

Understanding will be sacrificed if graphic design, or some other "flashy" mechanism draws attention away from the content.

Present large quantities of numbers in a small space.

We are often overwhelmed by many numbers; we need to make large data sets coherent.

Take advantage of the natural tendency to make visual comparisons.

It is easy for us to see relative differences.

Reveal information at various levels of detail.

It is easier to understand the bigger picture when the details are available to support it.

Data Quantity and Dimension

Advances in technology are allowing us to gather data at an ever-increasing rate. Microphones, video cameras, telescopes, satellites, radars, etc., work round the clock gathering more data about the universe around us. X-rays, ultrasound, computed tomography, magnetic resonance images, etc., are likewise gathering more data about the universe within us. From the immensity of the universe probed with radio telescopes, to the minutiae within molecules observed with electron microscopes, we are witnessing a massive flood of data such as has never before been seen in human history. In addition, to compound it all, doing so at a rate well beyond the human capacity to observe or understand it. The computing capabilities that thirty years ago were the sole domain of expensive computer installations at the defense department or in university laboratories are now well exceeded on the average homeowner’s desktop. Therefore, whether you are dealing with data generated by your computer from pure mathematical formulations, or measured with a physical sensor, perhaps the two most important considerations in deciding how to represent your data are likely to be the quantity of it and its dimension.

The quantity of the data might require you to consider statistical methods to show trends or occurrences of interest relative to the data set. The dimension of your data might require something more than a simple x-y plot. You might need to consider 3-D plots, slices of 2-D data, or combinations of 2-D and 3-D plots to get the emphasis you need. In any event, the old axiom, "A picture is worth a thousand words," is a mere understatement in today’s world.

Color, Light, and Shading

Color is probably the most commonly used, and abused, visualization technique. For instance, bright colors can be used to indicate that a particular item should be noted in a presentation, or to quickly draw your attention to points that exceed a threshold in a plot. One should always keep in mind that the intent of any visualization is to foster the communication of some idea, whether it be overall results or stressing a specific aspect of some analysis. In our brief discussion of color, we include lighting and shading as well.

In most simple visualizations, we can effectively use color to distinguish between different data series. This is most commonly seen as multiple lines of a plot where each line is a different color. Typically, in such simple plots, the two colors need only be distinguishable to clearly define the data. Unfortunately, plots are printed and copied and often not in color, then the advantages of color are lost. In such situations, it is good to denote each data series with a distinctive marker, or line style. Figure 2.1 and Figure 2.2 show similar plots of the same data. In Figure 2.1, the lines are plotted in blue and green, poor choices for black-and-white printing and possibly confusing even in color slide presentations where lighting is poor or someone has color blindness. Although different markers were used for each data series, they are not distinct enough to really help with the problem. Figure 2.2 is the better plot. Although the color might still be a problem in black-and-white printing, the line styles have been changed so that they are easily distinguishable, and a marker is used on only one data series. Figure 2.2 will convey the data better even when copied.

Although one trace is green and the other blue, this simple 2-line plot is difficult to read in low light or in black-and-white (as it is printed here).

Figure 2.1 Although one trace is green and the other blue, this simple 2-line plot is difficult to read in low light or in black-and-white (as it is printed here).

This 2-line plot is easier to read since two different line styles are used. It would look even better if it were in color.

Figure 2.2 This 2-line plot is easier to read since two different line styles are used. It would look even better if it were in color.

Varying hue is good for displaying different types of objects in visualization, but in many numerical analysis cases, we are interested in ordinal, interval, or ratio data. Differences in hues do not necessarily imply differences in magnitude; it is not obvious that red has a higher value than blue. Differing brightness levels (or saturation levels of a certain color) can convey differing magnitudes, and a gradual change from one hue to another is effective in doing this. Realize, however, that not everyone perceives color in the same way. Color blindness is common, and color perception even changes with age. When you use color, be sure that the meaning of the color is unambiguous. Think of color as another dimension for representing information. Never use it to "pretty-up" a graph.

Hue and transparency in a 3-D plot .

Figure 2.3 Hue and transparency in a 3-D plot .

Visualizing MRI Data

Figure 2.4 Visualizing MRI Data


Like color, motion is another representative dimension. Motion is used to represent changes over time, or to indicate sequential changes in higher dimensional data. Consider that a single observation that varies in time can be easily represented in a 2-D plot of the observation versus time. However, what happens if the measurements are 2-D themselves, such as a sequence of photographic images? This can be represented in a number of ways. Perhaps the most common is an image sequence, or frames.


The most useful data visualization methods allow the user to interact with the data by changing viewing angles, thresholding levels, applying false colors, and otherwise manipulating the presentation of the information content of the data dynamically. As you proceed through this topic, you will see that MATLAB allows some simple dynamic manipulations through the Figure Window. More importantly, you will see that MATLAB provides you with a host of graphics functions that allow you to build your own custom visualizations with which you can interact to any degree you wish if you are willing to program them so. Truly, the only limit to visualization with MATLAB is your imagination!

To whet your appetite, start your MATLAB and type demo at the command prompt.

Play with the MATLAB Demos.

Figure 2.5 Play with the MATLAB Demos.

Next post:

Previous post: