# Statistical Data Analysis Using R, SAS and Quadstat - Creating a Scatterplot

A scatterplot uses the cartesian coordinate axes to create points that is representative of the underlying data usually in two dimensions. Three dimensional scatterplots are possible if we add a z-axis to the already existing x- and y- axes. It is possible to even have a four-dimensional plot if we color code the points. However, for the remainder of this article, we will be solely discussing the bivariate scatterplot, that is a scatterplot with two variables.

The plot below graphs two variables, height and GPA. What do you think the relationship is between height and GPA? Are shorter people smarter? We can use a scatterplot to help us figure out (at least approximately, by eyeballing the plot). This data was found at Penn State University. If you would like to view the data on Quadstat, this page contains the entire Height and GPA dataset. To create the scatterplot in Quadstat, first choose the curated

Height and GPA
dataset from the Bivariate Plot app.

Next select the independent variable, height, by first clicking the height column header. Choose the dependent variable by clicking the GPA column header (The first column clicked is the independent variable). The spreadsheet will look something like this: Don't forget to choose a license for your analysis. If you would like a Shortlink to the analysis on Quadstat click Shortlink. Likewise, choose whether a PDF should be generated for the analysis. You'll see a scatterplot like the one created above in green if everything went well, and also depending on the options the user will get some additional links for a Short URL link this one: https://goo.gl/YwmYyM. A link to the PDF will also be available if chosen. A sample PDF is given here. R Code

To create this scatterplot in R, we will need to import the data and then use a plotting function for the visual like this:

plot(X);

This method assumes R is already installed and the data has been imported into the variable

X
.

SAS Code

To create this scatterplot in SAS, we will need to import the data and then use a plotting function for the visual like this..


PROC sgscatter  DATA=HEIGHTGPA;
PLOT height * gpa;
RUN;



## From Around the Site...

Title Authored on Content type
R Dataset / Package KMsurv / bnct March 9, 2018 - 1:06 PM Dataset
R Dataset / Package psych / affect March 9, 2018 - 1:06 PM Dataset
R Dataset / Package boot / grav March 9, 2018 - 1:06 PM Dataset
R Dataset / Package MASS / synth.te March 9, 2018 - 1:06 PM Dataset
R Dataset / Package HSAUR / watervoles March 9, 2018 - 1:06 PM Dataset