[R] eliminating white space in lattice plot

Duncan Mackay dulcalma at bigpond.com
Sat Jan 18 01:39:03 CET 2014


Hi 

The original email did not reach me so I am using this to reply

There is the trellis.device function for lattice graphs which in the past I
have had to use to create a pdf as just pdf would not do it
?trellis.device calls the device in this case  pdf()
? pdf  has the paper specification which explains the size as well as the
height and width 
If you are still wanting to crop white space around the plot see
par.settings in xyplot 
also have a look at trellis.par.get()$layout.widths and
trellis.par.get()$layout.heights these values can be changed in par.settings

Regards

Duncan

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mackay at northnet.com.au

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of arun
Sent: Saturday, 18 January 2014 02:38
To: r-help at r-project.org
Cc: Gerrit Draisma
Subject: Re: [R] eliminating white space in lattice plot

Hi,
May be this helps:
 x11(width=10,height=3)
 xyplot(y~x,data=X,type="l",aspect=0.25)
 dev.copy2pdf(file="wideplot.pdf")
dev.off()
A.K.




On Friday, January 17, 2014 11:26 AM, Gerrit Draisma <gdraisma at xs4all.nl>
wrote:
Dear R-users,
How do I get rid of the white space above and under a plot made with lattice
xyplot?

I searched the documentation but could not find how to do it.

Standard lattice plots are square,
but sometimes I want a wide but low graph and use aspect parameter to obtain
such a graph.
But then the plot has a lot of white space above and below the graph.
That makes it more difficult to include in a LaTeX document.

Thanks,
Gerrit Draisma

=============
library(lattice)
X<-data.frame(x=1:100,y=runif(100))
# pdf("wideplot.pdf")
xyplot(y~x,data=X,type="l",aspect=0.25)
# dev.off()

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


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




More information about the R-help mailing list