1

I wanted to ask for any general idea about plotting this kind of plot in R which can compare for example the overlaps of different methods listed on the horizontal and vertical side of the plot? Any sample code or something

Many thanks enter image description here

4

2 に答える 2

3

A ggplot2-example:

# data generation
df <- matrix(runif(25), nrow = 5)
# bring data to long format
require(reshape2)
dfm <- melt(df)
# plot
require(ggplot2)
ggplot(dfm, aes(x = Var1, y = Var2)) +
  geom_tile(aes(fill = value)) +
  geom_text(aes(label = round(value, 2)))

enter image description here

于 2012-11-15T11:25:44.137 に答える
1

corrplotパッケージとcorrplotそのパッケージ内の関数は、上に示したものと同様のプロットを作成します。これにより、必要なことを実行したり、開始点を提供したりできます。

より詳細な制御が必要な場合は、関数を使用して色をプロットしてからimage、関数を使用しtextて数値を追加できます。余白にテキストを配置するのに十分な大きさの余白を作成できます。余白axisにテキストラベルを追加する一般的な方法については、関数を参照してください。または、内部に十分なスペースを残して(おそらくrasterImageの代わりにimage使用)text、ラベル付けを行うために使用することもできます。線と、線のセグメントの座標を支援する関数を追加するかどうかのxpd引数を見てください。pargrconvertXgrconvertY

于 2012-11-15T15:53:38.107 に答える