Читать книгу Industrial Data Analytics for Diagnosis and Prognosis - Yong Chen - Страница 22
Relationship Between Two Numerical Variables – Scatter Plot
ОглавлениеIn a scatter plot, each observation is represented by a point whose coordinates are the values for the two variables of this observation. The following R
codes draw the scatter plot for two numerical variables, horsepower
and highway.mpg
, of the auto_spec
data set.
plot(auto.spec.df$highway.mpg ~ auto.spec.df$horsepower,
xlab = "Horsepower", ylab = "Highway MPG")
The obtained scatter plot is shown in Figure 2.4. It can be seen from the scatter plot that a general trend exists in the relationship between the highway MPG and the horsepower, where a car with higher horsepower is more likely to have a lower highway MPG.
Figure 2.4 Scatter plot of highway MPG versus horsepower.