Skip to content
Prev 319258 / 398503 Next

plot pch

Hello,

Try the following.

dat <-
structure(list(x = c(52.5211966906669, 49.8818953734405, 45.176643179385,
52.2988909042952, 46.1007828702965, 53.4910266471472, 49.013651970548,
55.1218462810432, 56.922347550005, 50.7531277271902), y = 
c(23.953008533893,
45.1590889001506, 62.5358474328017, 39.4861634272874, 49.3108455233261,
46.0010163238786, 46.5779093951996, 37.4552698003145, 46.4057156535496,
56.667549695452), z = c(1, 4, 1, 2, 1, 3, 4, 2, 1, 3), r = 1:10), .Names 
= c("x",
"y", "z", "r"), row.names = c(NA, -10L), class = "data.frame")

ch <- c(2, 22, 5, 1, 4)  # triangle, rectangle, rhombus, circle, cross.
plot(dat$x, dat$y, pch = ch[dat$z])
axis(4, at = dat$y, labels = seq_along(dat$y)[order(dat$y)])


Also, if you want to see the pch characters, run without worrying about 
the warnings (in general a bad tip, not really important here)

plot(1, type = "n", xlim=c(0, 17), ylim=c(0, 17))
for(x in 1:16) for(y in 1:16)
	points(x, y, pch = (x - 1)*16 + y)


They go first column with x = 1, from y = 1 to 16, etc.


Hope this helps,

Rui Barradas

Em 11-03-2013 17:43, eliza botto escreveu: