简体   繁体   中英

Change width of levelplot in R

I have created a levelplot() in R using a data set with 5 rows and 50 columns.

rgb.palette <- colorRampPalette(c("green", "red"), space = "Lab")
levelplot(mat, col.regions=rgb.palette, xlab = "Risk Level", ylab = "Zones", main = "Risk  Profile")

The result looks like this: 在此处输入图片说明

Can someone please advice, how can I expand the plot horizontally and the labels of x-axis to be visible clearly?

Bu default, levelplot() use the isometric aspect so one unit in x equals one unit in y. You can change the default with

levelplot(mat, col.regions=rgb.palette, 
    xlab = "Risk Level", ylab = "Zones", main = "Risk Profile", 
    aspect="fill")

I would use transpose matrix

tmat <- t(mat)
levelplot(tmat, col.regions=rgb.palette, xlab = "Risk Level", ylab = "Zones", main = "Risk  Profile")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM