简体   繁体   English

更改R中水平图的宽度

[英]Change width of levelplot in R

I have created a levelplot() in R using a data set with 5 rows and 50 columns. 我使用5行50列的数据集在R中创建了levelplot()。

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? 有人可以请教,我如何水平扩展绘图并使x轴的标签清晰可见?

Bu default, levelplot() use the isometric aspect so one unit in x equals one unit in y. 默认情况下, levelplot()使用等轴测图,因此x中的一个单位等于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")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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