Skip to content
Prev 365822 / 398502 Next

scatter plot of numerical variables against different sample ids

Hi Maria,

What happens is that R plots with boxplots (explaining the horizontal 
lines, i.e. boxes with n=1) when the x-variable is a factor.
What you can do is transform your Sample column into numeric and then 
plot it, with some adjustment of axis labels.

For example:
datf <- data.frame(Sample=c("M1","M2","M3","M4","M5"), 
Cu=c(1,2.5,1.15,2,8), Zn=c(5,11,11,4,15), Mn=c(10,8,12,30,35))
datf$Sample2 <- as.numeric(datf$Sample)
with(datf, plot(Sample2, Cu, type="l", lty=1, col="red", xaxt="n"))
axis(1, at=datf$Sample2, labels=datf$Sample)

It might not be the easiest/best approach though... Someone here might 
have a better idea.

HTH,
Ivan

--
Ivan Calandra, PhD
MONREPOS Archaeological Research Centre and
Museum for Human Behavioural Evolution
Schloss Monrepos
56567 Neuwied, Germany
calandra at rgzm.de
+49 (0) 2631 9772-287
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 05/12/2016 ? 13:25, Maria Lathouri via R-help a ?crit :