[R] PostScript scatter plot, losing points at RHS
Uwe Ligges
ligges at statistik.uni-dortmund.de
Sat Apr 9 18:27:23 CEST 2005
Jonathan Campbell wrote:
> On Apr 9, 2005 4:45 PM, Uwe Ligges <ligges at statistik.uni-dortmund.de> wrote:
>
>>Jonathan Campbell wrote:
>>
>>
>>>I'm using the following sequence to plot a scatter plot to PostScript.
>>>Those familiar with the Iris LDA example in MASS will recognise what
>>>I'm at.
>>
>>No, I don't recognise:
>>
>>- Which edition of MASS?
>
>
> My two sentences above were largely irrelevant and the link with MASS
> (4th ed. p. 333) was quite oblique. Ignore them, as I would expect
> most people would.
>
> However, your suggestion of performing a replicatible experiment is
> useful and an exact replica of my problem occurs in it. From MASS 4th
> ed. page 304.
>
> data(iris3); ir <- rbind(iris3[,,1], iris3[,,2], iris3[,,3])
> ir.species <- factor(c(rep("s", 50), rep("c", 50), rep("v", 50)))
> ir.pca <- princomp(log(ir), cor = T)
> ir.pc <- predict(ir.pca)
> plot(ir.pc[, 1:2], type = "n", xlab = "first principal component",
> ylab = "second principal component")
You forgot
text(ir.pc[,1:2], labels = as.character(ir.species))
> Apparently good plot (to screen). The 150 data points and three
> species appear to be there.
>
> Now to PostScript.
>
> postscript("irpca.eps", horizontal=FALSE, onefile=TRUE, height=6,
> width=6, pointsize=8, paper="special")
> plot(ir.pc[, 1:2], type = "n", xlab = "first principal component",
> ylab = "second principal component")
> text(ir.pc[,1:2], labels = as.character(ir.species))
You *really* forgot:
dev.off()
Everything fine for me, after using dev.off() ...
Uwe Ligges
> Problem. Only 21 "s" points shown -- over on left hand side of the plot.
>
> In my original problem also, the plot was limited 21 points.
>
> TIA,
>
> Jon C.
>
More information about the R-help
mailing list