How to show matrix values on Levelplot

后端 未结 3 1006
甜味超标
甜味超标 2020-12-05 17:04

I have a matrix data here, and I visualized it with levelplot. The Plot is placed below. But I just couldn\'t put the values into the plot, I mean I read this

3条回答
  •  醉酒成梦
    2020-12-05 17:22

    Another option is to use layer() from latticeExtra. It allows you to overlay one plot on top of another, using the + operator familiar to ggplot2 enthusiasts:

    library(latticeExtra)
    
    ## Applied to the example data in my other answer, this will produce
    ## an identical plot
    levelplot(Z ~ X*Y, data = grid) +
    layer(panel.text(X, Y, round(Z, 1)), data = grid)
    

提交回复
热议问题