Re: [R] Problem with plotting size/location on variation of star/segment plot

From: Uwe Ligges <>
Date: Sun 06 Mar 2005 - 05:49:21 EST

Shelby Berkowitz wrote:

> Dear R gurus,
> I'm running into a problem with some modified segment plots I've coded
> using stars(). What I am trying to do is superimpose two series of data
> along with radial axes markers in a 2x2 graphics frame. This is working
> fine now, except for the hitch: my plots overfill the frame and are not
> centered within it (on my runs they always end up looking like they've
> been budged up and to the left). They're also a little warped-looking
> (more oval than perfectly round).
> - I don't think this is a problem with my par() settings, as I've
> checked them out and they don't look suspicious. Also, I've tested
> generating other plots (e.g., dummy histograms) on the same device and
> they fit perfectly. It's also not a problem with fitting stars() plots
> into a par(mfrow=c(2,2) frame, as I get the same offset/overflow when I
> run just one plot on a mfrow=c(1,1) frame.
> - I don't think it's a problem with the windows graphics device, as I
> tried plotting to other devices (e.g., postscript) and get the same
> results.
> - Thus, I'm pretty sure this comes down to something funky with the way
> I'm using stars(). My runs of examples from stars() fit just as they
> should inside their graphics frames, but as far as I can see, the
> individual calls to stars() below don't look materially different from
> the ones in the examples.
> At this point, I'm completely stumped. Can someone please point me
> towards what I might be doing wrong here? Any and all advice will be
> most humbly appreciated!
> BTW, I'm running R 2.00 on Windows XP, all packages updated.
> Example version of my code is pasted below (the loop is for example
> purposes only):
> ##begin sample code
> par(mfrow=c(2,2))
> for (i in 1:4) {
> ## generate sample data for plot:
> a<- sample(c(20:70)*.01,18)
> testA <-
> ## open new plot space
> ## plot data series:
> stars(testA[2,], locations=0:1,full = TRUE, scale = F,
> draw.segments=TRUE, add=TRUE,col.segments=heatshades[7])

Well, since you have neither called plot.window() nor stars() with "add=FALSE"), the dimensions have not been set up correctly.

In the first call above, simply say add = FALSE.

Uwe Ligges

> stars(testA[1,], locations=0:1,full = TRUE, scale = F,
> draw.segments=TRUE, add=TRUE,col.segments=heatshades[3])
> majgrid <- matrix(rep((c(1:10)*.1),ncol(testA)),nrow=10,byrow=F)
> ## generate and plot radar grid:
> mingrid <-
> matrix(rep((c(1:10)*.1-.05),ncol(testA)),nrow=10,byrow=F)
> stars(majgrid, locations=0:1, scale=F, draw.segments = TRUE,
> add=T, lty=1, col.segments=0)
> stars(mingrid, locations=0:1, scale=F, draw.segments = TRUE,
> add=T, lty=2, col.segments=0)}
> par(mfrow=c(1,1))
> ##end sample code
> Thank you,
> Shelby
> ===============================
> Shelby L. Berkowitz
> Ecological-Community Psychology
> and Institute for Health Care Studies
> Michigan State University
> ______________________________________________
> mailing list
> PLEASE do read the posting guide! mailing list PLEASE do read the posting guide! Received on Sun Mar 06 05:59:25 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:41 EST