[R] Lattice: place ticks only on y-axis

Peter Ehlers ehlers at ucalgary.ca
Thu Jul 21 22:17:42 CEST 2011


On 2011-07-21 08:56, marcel wrote:
> I am using lattice for a bar plot, having a little trouble removing ticks,
> tick labels from x-axis, but keeping them on the y-axis. I looked around
> quite a bit (http://tolstoy.newcastle.edu.au/R/e7/help/09/06/1733.html, help
> pages, etc), tried variations of "scales = list(alternating = c(0,0)",
> "scales = list(alternating = c(0,0), tck = c(0,0))" and others, couldn't
> quite get it.
>
> #My code:
> tC<- textConnection("
> Time Type1 Type2 Type3
> 1.3 .50 .25 .25
> 4.5 .55 .25 .20
> 5.2 .65 .20 .15
> ")
>
> data1<- read.table(header=TRUE, tC)
> data2<- data.frame(Time=rep(data1$Time, 3), stack(data1[,2:4]))
> close.connection(tC)
> rm(tC)
>
> require(lattice)
> plot1<-xyplot(values ~ Time, scales = list(alternating = c(0,0), tck =
> c(0,0)), group=ind, data=data2, stack=TRUE, horizontal=FALSE,
> panel=panel.barchart, box.width=0.1,  axes=FALSE, ylim=c(-0.05,1.05),
> xlim=c(0,6), main="Plot1")
> print(plot1, position=c(0,0,1,.6))

Maybe just:

  xyplot(...., scales = list(x = list(draw = FALSE)), ....)

Peter Ehlers

>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Lattice-place-ticks-only-on-y-axis-tp3684094p3684094.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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