To do that with R, we change the color of the data points representing females to red:
plot(h$height,h$weight, xlab="Height (inches)", ylab="Weight (lbs)")
points(h$height[h$gender==1],h$weight[h$gender==1],col="red")
You can make a nicer looking plot with males shown in blue, females in red, and labels telling which is which:
plot(h$height,h$weight, xlab="Height (inches)", ylab="Weight (lbs)",col="blue")
points(h$height[h$gender==1],h$weight[h$gender==1],col="red")
legend(55,225, pch=1, col=c("red","blue"),legend=c("females","males"))
Note: To look up more details about legend()
, simply type ?legend
into R and press Enter to get the help information about the function.