亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

刪除某些級別的圖例條目

刪除某些級別的圖例條目

不負相思意 2019-12-04 14:52:08
是否可以刪除與某些因子水平相對應的圖例元素?在我的示例中,我希望刪除灰度因子級別(1-5)的圖例條目,而僅保留級別“最佳”,“建議”和“最差”。我已經嘗試了許多技巧,但是其中大多數都消除了條形的灰色(每組25個),或者只留下了我將紅色,黃色和綠色涂成紅色的條。# ggplot2barplot <- ggplot(training_results.barplot, mapping=aes(x=name, fill=factor(a))) # filling based on a column ##mapping=aes(x=name, fill=factor(a))barplot <- barplot + geom_histogram(stat = "identity", aes(name,wer)) ##colour="black"barplot <- barplot + scale_fill_manual(values=c("#555555", "#777777", "#555555", "#777777", "#555555", color.best, color.suggested, color.worst), labels=c(NA,NA,NA,NA,NA,"Best","Suggested","Worst")) # 6th = best; 7th = suggested; 8th = worstbarplot <- barplot + everyNthLabel(training_results$name,5) # only show every 5th label on x-axisbarplot <- barplot + theme_minimal()barplot <- barplot + theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust = 0.5),legend.position=c(.5, .9)) # rotate labels on x-axis ##, legend.position="none"barplot <- barplot + coord_cartesian(ylim = c(35, 45))# Legendbarplot <- barplot + guides(fill = guide_legend(title="Models", title.position="top", direction="horizontal"))# Axis labelsbarplot <- barplot + xlab("Number of EM-Training Iterations") + opts(axis.title.x = theme_text(vjust=-0.3))barplot <- barplot + ylab("Word Error Rate (WER)") + opts(axis.title.y = theme_text(vjust=0.2))到目前為止的結果; NA值應從圖例中省略。我正在使用的數據如下所示,a它是填充顏色應依賴的因素;a= 6、7和8標記突出顯示的情況(分別為綠色,黃色和紅色)。    a b c  name  corr   acc    H   D    S   I    N   wer1   1 1 1 1+1+1 66.63 59.15 4167 238 1849 468 6254 40.852   1 1 2 1+1+2 66.66 59.29 4169 235 1850 461 6254 40.713   1 1 3 1+1+3 66.81 59.42 4178 226 1850 462 6254 40.584   8 1 4 1+1+4 66.57 59.08 4163 223 1868 468 6254 40.925   1 1 5 1+1+5 66.89 59.34 4183 226 1845 472 6254 40.666   1 2 1 1+2+1 66.63 59.10 4167 240 1847 471 6254 40.907   1 2 2 1+2+2 66.82 59.45 4179 228 1847 461 6254 40.558   1 2 3 1+2+3 66.74 59.31 4174 225 1855 465 6254 40.699   1 2 4 1+2+4 67.00 59.50 4190 226 1838 469 6254 40.5010  1 2 5 1+2+5 66.90 59.19 4184 230 1840 482 6254 40.81etc.
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 489 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號