Bram Kuijper
2008-Jan-31 17:52 UTC
[R] decrease amount of ticks on y axis in lattice levelplot
Hi all, How can I decrease the number of ticks on the y-axis in a lattice levelplot()? I have as many ticks displayed on the y-axis as I have columns of data (1000 columns), how can I decrease this amount of ticks, while still properly displaying all the data? Note that I get my data from a matrix object, in which the z-values of the levelplot are the actual values in the matrix, whereas the row and column names are the x and y ticks (and thus character data). I guess that is character data is the root of the problem, but I don't know how to solve it. I tried to change the amount of ticks using yscale.components, but this doesn't work: yscale.components.myY <- function(...) { Y <- yscale.components.default(...) Y$left$ticks$at <- pretty(1,n=10) Y$left$labels$at <- pretty(1,n=10) return(Y) } print(levelplot(my_matrix),cuts=100,yscale.components=yscale.components.myY) My full code can be found on pastebin: http://pastebin.com/m16b267f9 thanks in advance for any help on this, Bram Kuijper
Weidong Gu
2008-Jan-31 18:19 UTC
[R] decrease amount of ticks on y axis in lattice levelplot
levelplot(, scale=list(y=list(tick.number=))) ?xyplot() Weidong Gu, Department of Medicine University of Alabama, Birmingham 1900 University Blvd., Birmingham, Alabama 35294 Email: wgu at uab.edu PH: (205)-975-9053 -----Original Message----- From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of Bram Kuijper Sent: Thursday, January 31, 2008 11:53 AM To: r-help at stat.math.ethz.ch Subject: [R] decrease amount of ticks on y axis in lattice levelplot Hi all, How can I decrease the number of ticks on the y-axis in a lattice levelplot()? I have as many ticks displayed on the y-axis as I have columns of data (1000 columns), how can I decrease this amount of ticks, while still properly displaying all the data? Note that I get my data from a matrix object, in which the z-values of the levelplot are the actual values in the matrix, whereas the row and column names are the x and y ticks (and thus character data). I guess that is character data is the root of the problem, but I don't know how to solve it. I tried to change the amount of ticks using yscale.components, but this doesn't work: yscale.components.myY <- function(...) { Y <- yscale.components.default(...) Y$left$ticks$at <- pretty(1,n=10) Y$left$labels$at <- pretty(1,n=10) return(Y) } print(levelplot(my_matrix),cuts=100,yscale.components=yscale.components. myY) My full code can be found on pastebin: http://pastebin.com/m16b267f9 thanks in advance for any help on this, Bram Kuijper ______________________________________________ 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.