1
$\begingroup$

I am trying to plot two variables x,y by running the script below

#!/usr/bin/env Rscript

#library(ggplot2)

#op
x = c(0.33, 0.24, 0.14, 0.28, 0.2)
#th
y = c(0.27, 0.26, 0.18, 0.22, 0.24)


plot(x,y, main="matrix",
    xlab="Op", ylab="Th", 
    xlim=c(0, 1), ylim=c(0, 1),
    abline(0,1, col="red"))

However, the plot produced only contains 5 points instead of a total of 10. So I figured, I am either doing something wrong or do not quite get what plot() does. Any thoughts?

$\endgroup$
1

1 Answer 1

2
$\begingroup$

You should only get 5 points, your plot function is plotting the x variable against the y variable on two axis and therefore there are only 5 pairs of values or points.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.