Meli
Meli

Reputation: 345

How to remove levelplot tick border in R?

The levelplot function renders heatmaps with tick marks on all sides of the box. I would like to maintain the tick marks on the x and y axis but remove those on the top and to the right.

How do I go about removing the right and top tick border around the box?

#fake data
data(mtcars)
cars.matrix <- as.matrix(mtcars[c(2:8)])
cars.corr <- cor(cars.matrix)
 
library('lattice')
levelplot(cars.corr, xlab="car stuff",ylab="Car Stuff", main="car stuff")
 

Car levelplot image

Upvotes: 3

Views: 5152

Answers (1)

rawr
rawr

Reputation: 20811

You can pass the parameter scales to levelplot which is used in ?xyplot which is where you will find the description:

scales: Generally a list determining how the x- and y-axes (tick marks and labels) are drawn.

  • tck Usually a numeric scalar controlling the length of tick marks. Can also be a vector of length 2, to control the length of left/bottom and right/top tick marks separately.
#fake data
data(mtcars)
cars.matrix <- as.matrix(mtcars[c(2:8)])
cars.corr <- cor(cars.matrix)

library('lattice')
levelplot(cars.corr, xlab="car stuff",ylab="Car Stuff", main="car stuff",
          scales = list(tck = c(1,0)))

enter image description here

Upvotes: 8

Related Questions