[R] Ternary Plots Do Not Display Ellipses in PDF

Paul Murrell paul at stat.auckland.ac.nz
Tue Oct 21 02:51:26 CEST 2014


Hi

I think the problem is that, as David Carlson pointed out, ellipses() 
works by redrawing the plot and adding more to it.

This means that your PDF version has *two pages*, one with the original 
plot, then another with the plot-plus-ellipses.

Paul

On 10/15/14 10:20, Rich Shepard wrote:
>    A rather strange situation here and I've not found the source of the
> problem.
>
>    The point is to print a ternary plot matrix of compositional data with
> ellipses enclosing 95% of the variance in each plot. The ellipses
> display on
> the monitor, dev = x11cairo (see attached winters-x11cairo.pdf), but not
> when
> sent directly to a file, dev = pdf (see attached winters-pdf.pdf).
>
>    Here's winters.acomp:
>
> structure(c(0.0666666666666667, 0.0612244897959184, 0.0434782608695652,
> 0.043956043956044, 0.05, 0.0161290322580645, 0.6, 0.571428571428571,
> 0.623188405797101, 0.593406593406593, 0.433333333333333,
> 0.629032258064516, 0.0666666666666667, 0.0612244897959184,
> 0.101449275362319, 0.0659340659340659, 0.0666666666666667,
> 0.032258064516129, 0.244444444444444, 0.26530612244898,
> 0.217391304347826, 0.263736263736264, 0.366666666666667,
> 0.290322580645161, 0.0222222222222222, 0.0408163265306122,
> 0.0144927536231884, 0.032967032967033, 0.0833333333333333,
> 0.032258064516129), .Dim = c(6L, 5L), .Dimnames = list(
>      NULL, c("filter", "gather", "graze", "predate", "shred")), class =
> "acomp")
>
>    And this is the command sequence:
>
>> library(compositions)
>> plot(winters.acomp, main="Winters Creek", cex=0.5)
>> r <- sqrt(qchisq(p=0.95, df=4))
>> mn <- mean(winters.acomp)
>> vr <- var(winters.acomp)
>> plot(winters.acomp, main="Winters Creek", cex=0.5)
>> ellipses(mean=mn, var=vr, r=r, steps=72, thinRatio=NULL, aspanel=FALSE,
>      col='red', lwd=2)
> # monitor plot window is manually closed.
>> pdf("winters-pdf.pdf")
>> plot(winters.acomp, main="Winters Creek", cex=0.5)
>> ellipses(mean=mn, var=vr, r=r, steps=72, thinRatio=NULL, aspanel=FALSE,
>      col='red', lwd=2)
>> dev.off()
>
>    What am I not seeing here that causes the different outputs?
>
> Rich
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul at stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/



More information about the R-help mailing list