2

grid パッケージでカラースケールをプロットしたい。heat.plot (10) のようなもの。

ここに画像の説明を入力

私はこのようなことを試みています:

require(grid)
legendViewport <- viewport(height=0.3, width=0.8)
pushViewport(legendViewport)
grid.rect(gp = gpar(col = "gray90"))

0 から 1 を 10 に分割し、heat.colors (10) を埋めたいとしましょう。それを行う簡単な方法はありますか。

4

1 に答える 1

2

色だけ欲しいなら、

grid.raster(t(heat.colors (10)), 
   width=unit(1,"npc"),
   height=unit(1,"npc"), int=FALSE)
于 2012-07-29T23:56:37.427 に答える