99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
首頁大數(shù)據(jù)時代非常驚艷的南丁格爾玫瑰圖
非常驚艷的南丁格爾玫瑰圖
2021-01-08
收藏

來源:AI入門學習

作者:伍正祥

一、名稱怎么來的

在克里米亞戰(zhàn)爭期間,南丁格爾發(fā)現(xiàn)戰(zhàn)地醫(yī)院的衛(wèi)生條件惡劣導致很多士兵死亡。因此,她開始研究傷員的死亡和衛(wèi)生環(huán)境的關系,并試圖用統(tǒng)計數(shù)據(jù)說服維多利亞女王改善軍事醫(yī)院的衛(wèi)生條件。但是她也擔心,女王那么忙,沒有時間看她那厚厚的報告和那些復雜的表格數(shù)據(jù)。于是,她設計了上面的這個生動又有趣的圖表,巧妙的展示了部隊醫(yī)院季節(jié)性的死亡率。她自己給它取名叫雞冠花圖(coxcomb)。

我們先來看看最早的南丁格爾玫瑰圖展示了什么樣的數(shù)據(jù)。這張圖展示的是1854年4月到1855年3月這一年間士兵的死亡情況。其中:

1)綠色表示死于可預防疾病的士兵人數(shù);

2)紅色表示死于槍傷的人數(shù);

3)黑色表示死于其他意外的人數(shù)。

從圖中可以看出,在這一年間,死亡人數(shù)最多的并不是在戰(zhàn)爭中受槍傷(紅色部分),大部分的士兵是死于可預防疾?。ňG色部分),特別是冬天的時候(1854年11月-1855年2月),死于可預防疾病的士兵人數(shù)大幅增加。這也反映出醫(yī)院的衛(wèi)生條件、保暖對于傷員的康復是多么的重要。因此,才說服了女王大人改善醫(yī)院條件。

二、玫瑰圖怎么用

這么有氣質(zhì)的圖表,我們來看看經(jīng)過這么多年的發(fā)展,大家都是怎么用的。盡管外形很像餅圖,但本質(zhì)上來說,南丁格爾玫瑰圖更像在極坐標下繪制的柱狀圖或堆疊柱狀圖。只不過,它用半徑來反映數(shù)值(而餅圖是以扇形的弧度來表示數(shù)據(jù)的)。但是,由于半徑和面積之間是平方的關系,視覺上,南丁格爾玫瑰圖會將數(shù)據(jù)的比例夸大。因此,當我們追求數(shù)據(jù)的準確性時,玫瑰圖不一定是個好的選擇。但反過來說,當我們需要對比非常相近的數(shù)值時,適當?shù)目浯髸兄诜直妗?

1. Facebook 和 twitter的用戶對比

1)圖表中包括性別、年齡、教育、收入等11個分類的對比信息指標,每個指標占用的圓周的角度相同,即任一指標的扇區(qū)角度為(360/11=32.723度)。

2)在“Gender”,“Income”,“Age”,“Education”四個指標中,又被分別劃成幾個不同的區(qū)段。

2、新冠肺炎全球疫情形勢

非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>

三、玫瑰圖怎么畫

案例1:facebook數(shù)據(jù)

直接使用上面facebook的數(shù)據(jù),關注公眾號AI入門學習回復【facebook】獲取csv文件,用R語言畫個示例,數(shù)據(jù)格式需要長格式,如下:非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>

#facebooks數(shù)據(jù) library(ggplot2)
facebook = read.csv("facebook.csv",header=T,stringsAsFactors = FALSE)
ggplot(facebook, aes(x = 類別1,y=比例,fill = 類別2)) + 
geom_bar(alpha = 0.93,stat="identity") + 
coord_polar()+ 
theme_bw()+ 
theme(panel.background = element_rect(fill = "black"))+
theme(axis.text = element_blank())+  
theme(axis.ticks = element_blank())+# 去掉左上角的刻度線 theme(axis.title = element_blank())+  
theme(legend.position = 'none')+# 去掉圖例 theme(panel.border = element_blank())+# 去掉外層邊框
 theme(panel.background = element_rect(fill = "black"))+ #黑色背景 theme(panel.grid.major.x = element_line(colour = 
"SpringGreen2", size = 0.3))+ #網(wǎng)格線設置     theme(panel.grid.major.y =
 element_line(colour = "SpringGreen2", size = 0.3))+ #網(wǎng)格線設置   ylim(-0.3,1.1)+
scale_fill_discrete(c=1000, l=100)
ggsave('rose.png',dpi = 1080)#保存為高清格式,dpi越大越清晰

圖形如下,可以根據(jù)個人喜好對顏色進行切換,當然,各種標注,可以在PPT中完成,多個對比的,也可以在PPT中進行拼接。非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>

用R自帶數(shù)據(jù)集畫一個不帶網(wǎng)格線的

dsmall = diamonds[sample(nrow(diamonds),5000),]
ggplot(dsmall, aes(x = clarity,  fill = cut)) + 
geom_bar(alpha = 0.85) + 
coord_polar() + 
theme_bw() + 
theme(panel.background = element_rect(fill = "black"))+
theme(axis.text = element_blank())+  
theme(axis.ticks = element_blank())+# 去掉左上角的刻度線 theme(axis.title = element_blank())+  
theme(legend.position = 'none')+# 去掉圖例 theme(panel.border = element_blank())+# 去掉外層邊框 
theme(panel.background = element_rect(fill = "black"))+ #黑色背景 theme(panel.grid=element_blank())+
ylim(-50,1000)+
scale_fill_manual(values = alpha(c("DarkOrchid1",  "SpringGreen", "Magenta","Cyan","OrangeRed1")))
ggsave('rose.png',dpi = 1080)
非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>
案例2:多圖組合

首先,介紹個函數(shù),多個圖組合到一起的

multiplot <- function(..., plotlist=NULL, file, cols=1, layout=NULL) {
      library(grid)
      plots <- c(list(...), plotlist)
      numPlots = length(plots)
      if (is.null(layout)) {
        layout <- matrix(seq(1, cols * ceiling(numPlots/cols)),
                         ncol = cols, nrow = ceiling(numPlots/cols))
      }

     if (numPlots==1) {
        print(plots[[1]])
      } else {
        grid.newpage()
        pushViewport(viewport(layout = grid.layout(nrow(layout), ncol(layout))))
        for (i in 1:numPlots) {
          matchidx <- as.data.frame(which(layout == i, arr.ind = TRUE))
          print(plots[[i]], vp = viewport(layout.pos.row = matchidx$row,
                                          layout.pos.col = matchidx$col))
        }
      }
    }

開始繪圖部分,下六組數(shù)據(jù)替換分別跑一次,得到 p1,p2,p3,p4,p5,p6,然后用上面定義的函數(shù)組合即可

par(mar=c(0,0,0,0)) #c(4,3,8,2,2,1) #c(4,3,5,2,2,10) #c(15,3,5,8,2,8) #c(1,3,5,3,2,8)
 #c(1,3,9,3,2,3) #c(2,12,9,3,2,3) data = data.frame(value= c(2,12,9,3,2,3), type = c('B','A','C','D','E',F))
p1 =
ggplot(data, aes(x =type, y=value, fill=type)) + 
geom_bar(stat = "identity", alpha = 0.99) + 
coord_polar() + 
theme_bw() + 
theme(panel.background = element_rect(fill = "black"))+
theme(axis.text = element_blank())+  
theme(axis.ticks = element_blank())+# 去掉左上角的刻度線 theme(axis.title = element_blank())+  
theme(legend.position = 'none')+# 去掉圖例 theme(panel.border = element_blank())+# 去掉外層邊框 theme(panel.background = 
element_rect(fill = "black"))+ #黑色背景 theme(panel.grid=element_blank())+
scale_fill_manual(values = alpha(c("OrangeRed1", 'gray91',"SpringGreen", "Magenta","Cyan", "DarkOrchid1")))
multiplot(p1,p2,p3,p4,p5,p6,cols=3)

結果如下:

非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>

重新替換一批數(shù)據(jù)得到下圖非常驚艷的南丁格爾<a href='/map/meiguitu/' style='color:#000;font-size:inherit;'>玫瑰圖</a>

數(shù)據(jù)分析咨詢請掃描二維碼

若不方便掃碼,搜微信號:CDAshujufenxi

數(shù)據(jù)分析師資訊
更多

OK
客服在線
立即咨詢
客服在線
立即咨詢
') } function initGt() { var handler = function (captchaObj) { captchaObj.appendTo('#captcha'); captchaObj.onReady(function () { $("#wait").hide(); }).onSuccess(function(){ $('.getcheckcode').removeClass('dis'); $('.getcheckcode').trigger('click'); }); window.captchaObj = captchaObj; }; $('#captcha').show(); $.ajax({ url: "/login/gtstart?t=" + (new Date()).getTime(), // 加隨機數(shù)防止緩存 type: "get", dataType: "json", success: function (data) { $('#text').hide(); $('#wait').show(); // 調(diào)用 initGeetest 進行初始化 // 參數(shù)1:配置參數(shù) // 參數(shù)2:回調(diào),回調(diào)的第一個參數(shù)驗證碼對象,之后可以使用它調(diào)用相應的接口 initGeetest({ // 以下 4 個配置參數(shù)為必須,不能缺少 gt: data.gt, challenge: data.challenge, offline: !data.success, // 表示用戶后臺檢測極驗服務器是否宕機 new_captcha: data.new_captcha, // 用于宕機時表示是新驗證碼的宕機 product: "float", // 產(chǎn)品形式,包括:float,popup width: "280px", https: true // 更多配置參數(shù)說明請參見:http://docs.geetest.com/install/client/web-front/ }, handler); } }); } function codeCutdown() { if(_wait == 0){ //倒計時完成 $(".getcheckcode").removeClass('dis').html("重新獲取"); }else{ $(".getcheckcode").addClass('dis').html("重新獲取("+_wait+"s)"); _wait--; setTimeout(function () { codeCutdown(); },1000); } } function inputValidate(ele,telInput) { var oInput = ele; var inputVal = oInput.val(); var oType = ele.attr('data-type'); var oEtag = $('#etag').val(); var oErr = oInput.closest('.form_box').next('.err_txt'); var empTxt = '請輸入'+oInput.attr('placeholder')+'!'; var errTxt = '請輸入正確的'+oInput.attr('placeholder')+'!'; var pattern; if(inputVal==""){ if(!telInput){ errFun(oErr,empTxt); } return false; }else { switch (oType){ case 'login_mobile': pattern = /^1[3456789]\d{9}$/; if(inputVal.length==11) { $.ajax({ url: '/login/checkmobile', type: "post", dataType: "json", data: { mobile: inputVal, etag: oEtag, page_ur: window.location.href, page_referer: document.referrer }, success: function (data) { } }); } break; case 'login_yzm': pattern = /^\d{6}$/; break; } if(oType=='login_mobile'){ } if(!!validateFun(pattern,inputVal)){ errFun(oErr,'') if(telInput){ $('.getcheckcode').removeClass('dis'); } }else { if(!telInput) { errFun(oErr, errTxt); }else { $('.getcheckcode').addClass('dis'); } return false; } } return true; } function errFun(obj,msg) { obj.html(msg); if(msg==''){ $('.login_submit').removeClass('dis'); }else { $('.login_submit').addClass('dis'); } } function validateFun(pat,val) { return pat.test(val); }