试图在ggplot中显示一个三角形图

时间:2015-08-12 16:02:29

标签: r ggplot2

在R 3.2.1中运行以下代码:

library(ggplot2)
library(plyr)
library(oce)
data <- matrix(runif(100),10,10)
dimnames <- list (time = 1:10, name = 1:10)
mat <- matrix(data, ncol=10, nrow=10, dimnames = dimnames)
df <- as.data.frame(as.table(mat))
(p <- ggplot(df, aes(name, time)) + 
   geom_tile(aes(fill = rescale), colour = "white") +
   scale_fill_gradient(low = "white", high = "steelblue"))

我收到此错误:

  

data.frame出错(fill = function(x,xlow,xhigh,rlow = 0,rhigh =   1,:参数意味着不同的行数:0,100

我做错了什么?

0 个答案:

没有答案