Skip to content

Different symbols for select points

2 messages · lauren mcdonagh, Sarah Goslee

#
On Mon, Oct 24, 2011 at 4:52 PM, lauren mcdonagh
<cleverlollipop at yahoo.ie> wrote:
You can use a vector for par and col, instead of a single value:

plot     (y~x,
xaxt = "n", type = "p", xlab = "Distance (m)",
ylab = "Concentrations (mg/kg)", cex.axis = .8, xlim = c(0,3000),
ylim = c(0,800), col=c(rep(2, 2), rep(4, 2), rep(2, 7)), pch =
c(rep(17, 2), rep(15, 2), rep(17, 7)),                bg = 2, sub =
"Zinc",
font.sub = 2)

If there's some criterion within your data that describes enriched and
unenriched, you can use that to create the vector, instead of doing it
manually as I did.

isEnriched <- c(1,1,2,2,1,1,1,1,1,1,1)

col=c("red", "blue")[isEnriched]
and
pch=c(2, 4)[isEnriched]

Alternatively, you can subset the data and use points() to add
different sets with different parameters.

Thanks for providing a reproducible example.

Sarah