[R] Setting a graph flushed to edges of axes
Deepayan Sarkar
deepayan.sarkar at gmail.com
Tue Feb 19 22:17:22 CET 2008
On 2/19/08, Saptarshi Guha <saptarshi.guha at gmail.com> wrote:
> Hello,
> I need to plot a line graph using lattice so that the endpoints are
> flush with the left and right vertical axes.
> So the scale end points and horizontal axes length should coincide.
> This works
>
> u=newdata[1:100,] #u[,1] is from 1700-1795
> xyplot(u[,2]~u[,1],xlim=range(u[,1]))
>
>
> Now u[,3] is a categorical variable and now I want use u[,3] as a
> conditioning variable yet still plot with the above condition
> sc <- list()
> sc$"x"=list(relation="free",tick.number=6)
> p1=u[u[,3]==1,1]
> p2=u[u[,3]==2,1]
> xlim=list(range(p1),range(p2))
> xyplot(u[,2]~u[,1]|u[,3],scales=sc,xlim=xlim,type="l",layout=c(1,2))
>
> In this case there is some padding between the endpoints and the
> vertical axes.
> How can I remove this padding?
A reproducible example would have helped, but perhaps you want
scales = list(x = list(relation = "free", axs = "i"))
-Deepayan
More information about the R-help
mailing list