[R] Re: histogram ... postscript - width of lines / plot margins

Cézar Freitas cafanselmo12 at yahoo.com.br
Wed Feb 16 19:26:11 CET 2005


Thanks. You answer works well. But this time I get 2
problems:

- because the region of plot is shorter then the
default, the width of lines of plots is larger (see
the two attached pictures .ps) and the lwd command
don't deals with it;
- the plot region contains big margins (the picture
has 3x3 inches, but the plot uses only 2x2)

The code:

  par(fin=c(3,3))
  scores<-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0, 5.0,
2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0, 3.0,
3.0)
  q<-summary(scores)
  gra<-hist(scores, breaks=((0:11)/2-.2), plot=FALSE)
  yy<-ceiling(max(gra$counts)/10)*10
  yz<-yy/12

  postscript("test.ps", width=3, height=3,
horizontal=FALSE, family="Times", paper="special")

  hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6),
ylim=c(-yz,yy), main="scores", ylab="Freq",
xlab="math", cex.axis=.3, cex.main=.3, cex.sub=.3,
cex.lab=.3, mgp=c(1.5,.5,0))
  boxplot(scores, horizontal=1, add=1, at=-2*yz/3,
boxwex=1.5*yz, bty="n", axes=FALSE)
  points(q[4], -2*yz/3, col=1, pch="+", cex=.5)

  dev.off()



 --- Uwe Ligges <ligges at statistik.uni-dortmund.de>
escreveu: 
> Cézar Freitas wrote:
> 
> > Hi, all. I need plot a boxplot under a histogram
> like
> > below, but some configs are troubled:
> > 
> > - the boxplot contours the plot, even if I put
> > bty="n", modifying the histogram plot;
> 
> You want to set  "axes = FALSE" in boxplot()
> BTW: What is q[4]  in your call to points()?
> 
> 
> Uwe Ligges
> 
> 
> > - I changed the configs of axis to do a 3x3 inches
> > plot, but the result is 2 different axis.
> > 
> > For example, the code below ilustrates this...
> > 
> > 
> >   scores<-c(2.0, 0.0, 5.0, 5.0, 5.0, 2.0, 0.0,
> 5.0,
> > 2.5, 4.0, 5.0, 0.0, 5.0, 0.0, 2.0, 5.0, 5.0, 2.0,
> 3.0,
> > 3.0)
> > 
> >   postscript("test.ps", width=3, height=3,
> > horizontal=FALSE, family="Times", paper="special")
> > 
> >   gra<-hist(scores, breaks=((0:11)/2-.2),
> > xlim=c(-1,6), plot=FALSE, cex.axis=.5,
> cex.main=.5,
> > cex.sub=.5, cex.lab=.5, mgp=c(1.5,.5,0))
> > 
> >   yy<-ceiling(max(gra$counts)/10)*10
> >   
> >   hist(scores, breaks=((0:11)/2-.2), xlim=c(-1,6),
> > ylim=c(0,yy), main="scores", ylab="Freq",
> xlab="math",
> > cex.axis=.5, cex.main=.5, cex.sub=.5, cex.lab=.5,
> > mgp=c(1.5,.5,0))
> >   boxplot(scores, horizontal=1, add=1, at=-yy/50,
> > boxwex=yy/20, bty="n", cex.axis=.5, cex.main=.5,
> > cex.sub=.5, cex.lab=.5, ann=FALSE)
> >   points(q[4], -yy/50, col=1, pch="x", cex=.2)
> > 
> >   dev.off()
> > 
> > 
> > Thanks,
> > C.
> > 
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
> 
>  


	
	
		
_______________________________________________________ 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: via_postscript.ps
Type: application/postscript
Size: 6629 bytes
Desc: via_postscript.ps
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20050216/5b70d984/via_postscript.ps
-------------- next part --------------
A non-text attachment was scrubbed...
Name: via_R.ps
Type: application/postscript
Size: 32296 bytes
Desc: via_R.ps
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20050216/5b70d984/via_R.ps


More information about the R-help mailing list