簡體   English   中英

我在ggplot2上的Heatmap沒有顯示部分數據,但data.frame似乎還不錯

[英]My Heatmap on ggplot2 isn't showing part of the data but the data.frame seems to be fine

我正在嘗試以下方法:

MAPE <- c(.236, .186, .047, .035, .013, 3.117, 3.092, 3.021, 2.975, 1.616,
          .192,.131, .07, .017, 0, .431, .404, .321, .301, .821,
          .236, .18, .098, .083, .061, 3.117, 3.09, 2.998, 2.955, 2.094,
          .192,.125, .118, .039, .05, .431, .405, .314, .309, .9)
DemandSys <- c("Logit","Logit","Logit","Logit", "Logit",
               "Log-Linear", "Log-Linear","Log-Linear","Log-Linear", "Log-Linear",
               "Linear", "Linear","Linear","Linear","Linear",
               "AIDS", "AIDS", "AIDS", "AIDS", "AIDS")
Method <- rep(c("UPP_no", "UPP_avg", "UPP_est", "Simp", "FOA"), 8)
Eff <- c("both", "both", "both", "both", "both", "both", "both", "both", "both", "both",
         "one", "one", "one", "one", "one","one", "one", "one", "one", "one")
MAPE <- cbind.data.frame(MAPE, Method, Eff, DemandSys)

library(scales)

ggplot(MAPE, aes(x=DemandSys, y=Method, fill=MAPE)) + 
  geom_tile()+ 
  facet_wrap(~ Eff, nrow = 1)

但是,似乎有很大一部分數據無法讀取到該“熱圖”中。 我一直在檢查data.frame,一切似乎都井井有條。 有什么建議么?

問題解決了。 我的Eff向量太短,因此弄亂了數據。 謝謝大家

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM