作爲循環的一部分,我創建了幾個雷達圖。每個圖表都是一個國家,蜘蛛網中顯示的信息是數年(不同顏色的線)的數據。我正在嘗試添加一個圖例來說明哪一行(顏色)與哪一年有關。據我所知,雷達圖上的幫助文件對此沒有提及。 (我在這個問題上看到了前面的post,但不認爲它適用,因爲我在這裏循環工作)。我會很感激任何提示。Legend with Radarchart in loop
這裏是與循環的一次迭代的數據:
require(fmsb)
Radar.tmp<–list(cowc = c("0", "0", "ZIM", "ZIM", "ZIM", "ZIM",
"ZIM", "ZIM", "ZIM", "ZIM", "ZIM", "ZIM", "ZIM", "ZIM", "ZIM",
"ZIM"), year = c(0, 0, 1996, 1998, 2000, 2002, 2003, 2004, 2005,
2006, 2007, 2008, 2009, 2010, 2011, 2012), RoL.Estimate = c(2.5,
-2.5, -0.82, -0.71, -1.33, -1.59, -1.68, -1.76, -1.77, -1.73,
-1.78, -1.77, -1.84, -1.81, -1.79, -1.62), GovEff.Estimate = c(2.5,
-2.5, -0.23, -0.37, -0.78, -0.9, -0.95, -0.95, -1.29, -1.3, -1.27,
-1.5, -1.52, -1.5, -1.36, -1.21), RegQual.Estimate = c(2.5, -2.5,
-0.98, -0.79, -1.46, -1.97, -2, -2.03, -2.21, -1.96, -2.16, -2.11,
-2.1, -2.05, -1.92, -1.83), ControlCorruption.Estimate = c(2.5,
-2.5, -0.25, -0.65, -0.95, -1.21, -1.25, -1.31, -1.28, -1.33,
-1.36, -1.31, -1.32, -1.31, -1.38, -1.27), PolStab.Estimate = c(2.5,
-2.5, -0.53, -0.88, -1.42, -1.6, -1.14, -1.26, -1.24, -0.91,
-1.11, -1.2, -1.16, -1.12, -0.95, -0.79), VoiceAccount.Estimate = c(2.5,
-2.5, -0.62, -0.82, -1.11, -1.41, -1.44, -1.55, -1.66, -1.54,
-1.57, -1.54, -1.54, -1.48, -1.47, -1.45)), .Names = c("cowc",
"year", "RoL.Estimate", "GovEff.Estimate", "RegQual.Estimate",
"ControlCorruption.Estimate", "PolStab.Estimate", "VoiceAccount.Estimate"
), row.names = c(1L, 2L, 2689L, 2690L, 2691L, 2692L, 2693L, 2694L,
2695L, 2696L, 2697L, 2698L, 2699L, 2700L, 2701L, 2702L), class = "data.frame")
此處可用於radarchart命令:
radarchart(Radar.tmp[,c("RoL.Estimate","GovEff.Estimate","RegQual.Estimate","ControlCorruption.Estimate","PolStab.Estimate","VoiceAccount.Estimate")],
axistype=2, seg=10, pcol=1:8, pty=16, plty=1, maxmin=TRUE, axislabcol="grey", title=c)
這裏是曲線圖,因爲它看起來在此刻:
請注意,循環中的年數(行數)將從迭代更改爲迭代。
我知道雷達圖有一些嚴重的缺陷,但會要求你把它們暫時放在一邊。
非常感謝任何提示/建議!
我無法得到它來運行。錯誤:意外的')'in')「 – raylee