[R] PostScript scatter plot, losing points at RHS
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sat Apr 9 18:29:15 CEST 2005
Assuming you did
dev.off()
or quit the session at the end, I cannot reproduce this (even with 1.9.0).
If you did, it is almost surely a faulty viewer (so check the actual
file): if not you would have an incomplete plot since you failed to flush
the output file buffer.
On Sat, 9 Apr 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.
That plot works too.
> 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")
>
> 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))
>
> 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.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list