3行R语言代码绘制泄漏密码直方图
根据网上的统计,把密码次数存成以下格式
"Word" "Freq"
"1" "123456789" 81839
"2" "12345678" 75513
"3" "11111111" 27157
"4" "dearbook" 18788
"5" "00000000" 12309
"6" "123123123" 6850
"7" "1234567890" 6150
"8" "88888888" 5318
"10" "111111111" 2506
"11" "147258369" 2081
"12" "987654321" 1995
"13" "aaaaaaaa" 1902
"14" "66666666" 1819
"15" "1111111111" 1804
"16" "xiazhili" 1663
"17" "11223344" 1501
"18" "a123456789" 1485
"19" "1qaz2wsx" 1300
"20" "qqqqqqqq" 1241
然后执行R代码
dt<-read.table("pass.txt", sep = " ",header=T,strip.white = TRUE,blank.lines.skip=FALSE,fill=TRUE,comment.char = "");
par(las=2,xpd = TRUE,xaxt="n",mar=c(3, 6, 3, 3));
barplot(dt$Freq[20:1],main="常用密码",names.arg = dt$Word[20:1],horiz=T,col=rev(heat.colors(length(dt$Freq[1:20]))));
结果如下: