12.07.2015 Views

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

COPYRIGHT 2008, PRINCETON UNIVERSITY PRESS

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

46 chapter 3is regular practice to use 3-D (surface) plots, volume rendering (dicing and slicing),and animation, as well as virtual reality (gaming) tools.These types of visualizationsare often breathtakingly beautiful and may provide deep insights into problems byletting us see and “handle” the functions with which we are working. Visualizationalso assists in the debugging process, the development of physical and mathematicalintuition, and the all-around enjoyment of your work. One of the reasons forvisualization’s effectiveness may arise from the large fraction (∼10% direct and∼50% with coupling) of our brain involved in visual processing and the advantagegained by being able to use this brainpower as a supplement to our logical powers.In thinking about ways to present your results, keep in mind that the pointof visualization is to make the science clearer and to communicate your work toothers. It follows then that you should make all figures as clear, informative, andself-explanatory as possible, especially if you will be using them in presentationswithout captions. This means labels for all curves and data points, a title, and labelson the axes. 2 After this, you should look at your visualization and ask whether thereare better choices of units, ranges of axes, colors, style, and so on, that might get themessage across better and provide better insight. Considering the complexity ofhuman perception and cognition, there may not be a single best way to visualize aparticular data set, and so some trial and error may be necessary to see what looksbest. Although all this may seem like a lot of work, the more often you do it thequicker and better you get at it and the better you will be able to communicate yourwork to others.3.2 PtPlot: 2-D Graphs Within JavaPtPlot is an excellent plotting package that lets you plot directly from Javaprograms. 3 PtPlot is free, written in Java (and thus runs under Unix, Linux, MacOS, and MS Windows), is easy to use, and is actually part of Ptolemy, an entire computingenvironment supported by the University of California Computer ScienceDepartment. Figure 3.1 is an example of a PtPlot graph. Because PtPlot is not builtinto Java, a Java program needs to import the PtPlot package and work with itsclasses. You can download the most recent version over the Web.The program EasyPtPlot.java in Listing 3.1 is an example of a how to constructa simple graph of sin 2 (x) versus x with PtPlot (Figure 3.1 top). On line 2 we see thestatement import ptolemy.plot.*; that imports the PtPlot classes from the ptolemydirectory. (In order for this to work, you may have to modify your classpathenvironmental variable or place the ptolemy directory in your working directory.)PtPlot represents your plot as a Plot object, which we name plotObj and create online 9 (objects are discussed in Chapter 4, “Object-Oriented Programs: Impedance& Batons”). We then add various features, step by step, to plotObj to make it justthe plot we want. As is standard with objects in Java, we first give the name of theobject and then modify it with “dot modifiers.” Rather than tell PtPlot what ranges2 Although this may not need saying, place the independent variable x along the abscissa(horizontal), and the dependent variable y = f(x) along the ordinate.3 Connelly Barnes assisted in the preparation of this section.−101<strong>COPYRIGHT</strong> <strong>2008</strong>, PRINCET O N UNIVE R S I T Y P R E S SEVALUATION COPY ONLY. NOT FOR USE IN COURSES.ALLpup_06.04 — <strong>2008</strong>/2/15 — Page 46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!