在图像{graphics}中添加颜色图例 [英] Add a legend of colors in image {graphics}

查看:73
本文介绍了在图像{graphics}中添加颜色图例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此示例中,我有一个带有颜色的图像,我想知道是否可以添加颜色图例.例如:[8:10]中带有z的点具有红色等.

In this example, I have an image with colors and I wonder if we can add a legend of colors. for example : points with z in [8:10] have color red and so on.

x=runif(500,0,5)
y=runif(500,0,5)
z=floor(runif(500, 1,10)) 
xyz=data.frame(x,y,z)
library(MBA)
mba.int <- mba.surf(xyz, 300, 300, extend=T)$xyz.est
image(mba.int, xaxs="i", yaxs="i")

谢谢.

推荐答案

感谢@ user20650,答案是:

Thanks to @user20650, the answer is :

fields::image.plot(mba.int, col = heat.colors(12))

这篇关于在图像{graphics}中添加颜色图例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆