I am trying to make a stripchart()
with dots colored using a simple palette. This is a small example with my attempt:
df = data.frame(V1=runif(100,-1,1), V2=runif(100,0,1))
stripchart(df$V2, method="jitter",
col=factor(df$V1),
vertical=TRUE, pch=19, add=FALSE,
cex=0.8, jitter=0.2, at=1)
However, I haven't been able to color de dots as I want, that is, plot the values of the 2nd column with colors according to the values of the 1st column.
If possible, I would like to use a red-blue palette like RColorBrewer::brewer.pal(n=10, name="RdYlBu")
, but I am not sure how to implement it.
Does anyone know how to do this in R?
Any help would be appreciated, thanks in advance!