Chapter 4 Graphical Visualization 4 1 Plotting Points













- Slides: 13

Chapter 4: Graphical Visualization 4. 1: Plotting Points for Scatter Plots and Trend Lines

*A scatter plot is a graph with points to show a possible relationship between two sets of data. Please read all of this information. It is important!

It can be used effectively to show some trends. Table 4. 1 contains the data for the temperature relationship between Fahrenheit and Celsius.

The program points. ch plots these five data points on a scatter plot, as shown in Figure 4. 1. The graph reveals that the temperature relationship between Fahrenheit and Celsius is linear.

Header & Header File Cplot is used to label a header. (shows up as the color pink in the line) CPlot can be used to define variables. Commonly used as: Cplot;

Directions from the book. Read this. Then, look for these lines in your code.

Adding Labels to the X and Y coordinates. Plot. label(PLOT_AXIS_X, “xlabel”); Plot. label(PLOT_AXIS_Y, “ylabel”); You need to put in values so we know how big the coordinate plane will be. If you do not label these then the default for the xaxis will be “x” and for the y-axis will be “y”.

Plotting a point: Plot. point(x, y); This draws a point to the coordinates given for x & y

Created the chart from Table 4. 1. Create a new file and enter these lines: Plot. point(-10, -23. 33); Plot. point(20, -6. 67); Plot. point(50, 10. 00); Plot. point(80, 26. 67); Plot. point(110, 43. 33);

After the plotting data are added, the program needs to call the function to generate a plot. So at the end of that program you need to enter: plotting(); This will tell the program that it needs to plot the information. **If you don’t add this to the end of your program, it will not run properly.

Create a program: points. ch. Type the following into the CHIDE program. ***Type ALL of it! **Even the comments that are in green and separated with a //

Then take a ‘screenshot’ of what you see after you “run” the program. 1 Directions for taking a picture on the screen: 1. Open the “Snipping Tool” 2. Click on “New” 3. Then just drag the cursor over what you want to take a picture of and let go. 4. Then save it. File, Save As: firstnamelastname. ch 5. Save to desktop and turn in to google docs TODAY, it won’t be there if you log on again. The computers are wiped clean daily! 2

Great job today! I hope that this helps you understand plotting points while coding a little better.