【问题标题】:Rapache brew is generating dark graphsRapache brew 正在生成暗图
【发布时间】:2012-03-26 08:25:52
【问题描述】:

我终于想通了 rapahce brew。它可以正常工作,但是当我加载 http:localhost/test.brew 文件时,我的浏览器会显示一个黑色方块。当我查看该位置的文件时,它就在那里。

有人看过吗?

这是 test.brew 文件的内容:

<%

library(reshape2)
library(ggplot2)
library(Cairo)

x <- data.frame(read.table("/R/output/output.txt", sep=",", header=T))
y <- melt(x, id=c("Hostname", "Date", "MetricType"))
y$value <-as.numeric(y$value)
yy <- dcast(y, Hostname + Date + variable ~ MetricType, fun.aggregate=mean)
yy$variable <- as.integer(gsub('Hour', '', yy$variable))
yy$variable <- paste(yy$variable, ":00:00", sep='')
yy$Date <- as.Date(yy$Date, format='%m/%d/%Y')
yy$Date <- paste(yy$Date, yy$variable)
db1 <- subset(yy, yy$Hostname=="server1")
db1<-data.frame(db1)
db1$Date <-as.POSIXct(db1$Date, "%Y-%m-%d %H:%M:%S", tz="EST")

filename <- paste(tempfile(tmpdir='/usr/local/apache2/htdocs'), '.png', sep='')
CairoPNG(filename)
qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1")
dev.off()


%>
<img src="<%=gsub('/usr/local/apache2/htdocs', '', filename)%>"/>                                   
</body>
</html>

【问题讨论】:

  • 这些问题最好在 rapache google 小组中得到解答。去那边问问。

标签: r rapache


【解决方案1】:

如果有人有同样的问题,这里就是答案:

print(qplot(Date, CPUAVG, data=db1, geom=c("line", "smooth"), method = "lm", ylab="AVG CPU", xlab="Date", main="Server1"))

qplot 需要被 print 语句包裹起来。

【讨论】:

  • 这在许多不同的情况下经常出现,也适用于 lattice。事实上,它经常是FAQ
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-11-10
  • 2017-09-16
  • 1970-01-01
  • 1970-01-01
  • 2012-05-27
  • 2016-06-26
  • 1970-01-01
相关资源
最近更新 更多