[R] handle graph size in eps

Benoit Boulinguiez benoit.boulinguiez at ensc-rennes.fr
Mon Mar 2 17:26:04 CET 2009


Sorry for the lack of information.

I'm indeed under Windows. I indeed used the menu "save as" in the graph
window.

The matter with the eps obtained was the width of the graph which is lower
than what I had on the screen or what I got when I saved it as a JPEG file. 

I tried the "postscript" command

postscript("test.eps",width=14,height=6)
print.it=TRUE
{
#windows(width=6,height=6)
par	(
	fin=c(6,6)
	,mai=c(1,1,0.5,0.5)
	,mfrow=c(1,2)
	,cex.axis=1.5
	,cex.lab=1.5)

dens<-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel="gaussian")

xlimit<-range(dens$x)
ylimit<-range(dens$y)

hist(
	DATA1.y[2,]-mean(DATA1.y[2,])
	,xlim=1.1*xlimit
	,xlab=expression(q[e])
	,ylim=1.1*ylimit
	,probability=T
	,main="Random distribution around y")
lines(dens,col=2,lwd=2)
qqnorm(DATA1.x[1,])
}
dev.off()
rm(dens,xlimit,ylimit)


I barely managed to get the ratio I want for the graph
http://www.4shared.com/file/90339223/5a3239fc/test.html
But still when I change the width in the poscript command from 12" to 20"
for instance, it doesn't change anything... why?

BTW how do I stop the pipe between a poscript file and R without closing R?


Regards/Cordialement


Benoit Boulinguiez 


-----Message d'origine-----
De : Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Envoyé : lundi 2 mars 2009 11:25
À : Benoit Boulinguiez
Cc : r-help at r-project.org
Objet : Re: [R] handle graph size in eps

On Mon, 2 Mar 2009, Benoit Boulinguiez wrote:

> Hi all,
>
> I've got a density graph made with the following commands:
>
> win.graph(width=13,height=6)

The preferred name is windows().

> par (
> fin=c(13,3)
> ,mai=c(1,1,0.5,0.5)
> ,mfrow=c(1,2)
> ,cex.axis=1.5
> ,cex.lab=1.5)
>
> dens<-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel="gaussian")
>
> xlimit<-range(dens$x)
> ylimit<-range(dens$y)
> hist(
> DATA1.y[2,]-mean(DATA1.y[2,])
> ,xlim=1.1*xlimit
> ,xlab=expression(q[e])
> ,ylim=1.1*ylimit
> ,probability=T
> ,main="Random distribution around y")
> lines(dens,col=2,)
> rm(dens,xlimit,ylimit)
>
> qqnorm(DATA1.x[1,])
>
> that's what I've on the screen and I'm OK with that.
> http://www.4shared.com/file/90283562/9f27d83b/screen.html
>
> When I save the graph in eps format

How exactly?  I know at least three ways to do that.  I am guessing that as
you didn't tell us you were on Windows, you also didn't tell us that you
used the menu on the windows() device, but these details do matter.

> I've got that
> http://www.4shared.com/file/90283115/490b7383/density_v_1.html
>
> what am I doing wrong?

Not telling us what you don't like about this plot.

I think you should consider using dev.copy2eps(), which will give you more
control.  Or even better, calling postscript() directly.

-- 
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