Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

plot.

new()

x <- rnorm(100)

y <- rnorm(100)

g <- gl (2, 10, labels = c("kelas A","kelas B"))

str(g)

plot(x,y, type = 'n') #Draws no points

points(x[g == "kelas A"], y[g == "kelas A"],

col = "blue",

pch = 1)

points(x[g == "kelas B"], y[g == "kelas B"],

col = "red",

pch = 19)

legend ("topleft", c("kelas A", "kelas B"),

col = c ("blue","red"),

pch = c(1,19))

You might also like