散點圖真是一個比較神奇的圖形,正如它的名字一樣,一堆紛亂如麻的圓點,看似無跡可尋卻能顯示出數據難以顯示的內在邏輯關系。很多人稱它“萬表之王”,它在數據分析師手里已經演化成了一個強大的數據分析工具。
你一般會選擇哪種工具來做數據可視化?Lisa Charlotte Rost從去年五月開始嘗試了24種工具或語言來畫一張氣泡圖,經過半年的學習實踐發現沒有完美的可視化工具,每個工具都有各自的優缺點,但是對于某些領域目的,還是有比較推薦的可視化工具。
以下紅色的是軟件,藍色的是語言
越靠左越適合做數據分析,越靠右越適合做展示
越靠右越靈活
左側是靜態,右側是互動
越往左越容易上手,越往上越靈活
這是一張工具選擇推薦圖,根據目的分類
左上是簡單快捷的目的,左下是故事導向,右上是為了分享的分析,右側是創新型圖表,右下是分析型工具
在看完對工具的推薦后,有興趣的可以看下這24種工具是如何實現氣泡圖的。
數據源統一如下,4個字段分別為國家,人均收入,壽命,人口總數,想要做的效果是一個氣泡圖,X軸為人均收入,Y軸為壽命,氣泡大小為人口總數
工具1:Excel
工具2:Google Sheets
工具3:Adobe Illustrator
工具4:RAW by DensityDesign
工具5:Lyra
工具6:Tableau Public
工具7:Polestar
工具8:Quadrigram
工具9:Highcharts Cloud
工具10:Easychart
工具11:Plotly
工具12:NodeBox
工具13:R – native
#set working directorysetwd("Desktop")#read csvd = read.csv("data.csv", header=TRUE)#plot chart, set range for x-axis between 0 and 11symbols(log(d$income),d$health,circles=d$population,xlim = c(0,11))
工具14:R – ggplot2
#import librarylibrary(ggplot2)#set working directorysetwd("Desktop")#read csvd = read.csv("data.csv", header=TRUE)#plot chartggplot(d) + geom_point(aes(x=log(income),y=health,size=population)) + expand_limits(x=0)
工具15:R – ggvis
#import librarylibrary(ggvis)library(dplyr)#set working directorysetwd("Desktop")#read csvd = read.csv("data.csv", header=TRUE)#plot chartd %>% ggvis(~income, ~health) %>% layer_points(size= ~population,opacity:=0.6) %>% scale_numeric("x",trans = "log",expand=0)
工具16:Python - matplotlib
#import librariesimport numpy as npimport pandas as pdimport matplotlib.pyplot as plt#read datadata = pd.read_csv("data.csv")#plot chartplt.scatter(np.log(data['income']), data['health'], s=data['population']/1000000, c='black')plt.xlim(xmin=0) #set origin for x axis to zeroplt.show()
工具17:Python - Seaborn
#import librariesimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as sns#read datadata = pd.read_csv("data.csv")#plot chartg = sns.regplot('income', 'health', data=data, color='k',fit_reg=False)g.set_xscale('log')plt.show()
工具18:Python - Bokeh
#import librariesimport pandas as pdfrom bokeh.plotting import figure, show, output_file#read datadata = pd.read_csv("data.csv")#plot chartp = figure(x_axis_type="log")p.scatter(data['income'], data['health'], radius=data['population']/100000, fill_color='black', fill_alpha=0.6, line_color=None)#write as html file and open in browseroutput_file("scatterplot.html")show(p)
工具19:Processing
void setup() {size(1000,500); #sets size of the canvasbackground(255); #sets background colorscale(1, -1); #inverts y & x axistranslate(0, -height); #inverts y & x axis, step 2Table table = loadTable("data.csv", "header"); #loads csv for (TableRow row : table.rows()) { #for each rown in the csv, do: float health = row.getFloat("health"); float income = row.getFloat("income"); int population = row.getInt("population"); #map the range of the column to the available height: float health_m = map(health,50,90,0,height); float income_log = log(income); float income_m = map(income_log,2.7, 5.13,0,width/4); float population_m =map(population,0,1376048943,1,140); ellipse(income_m,health_m,population_m,population_m); //draw the ellipse }}
工具20:D3.js
<!-- mostly followed this example:http://bl.ocks.org/weiglemc/6185069 --><!DOCTYPE html><html><head> <style> circle { fill: black; opacity:0.7; } </style> <script type="text/javascript" src="D3.v3.min.js"></script></head><body> <script type="text/javascript"> // load data var data = D3.csv("data.csv", function(error, data) { // change string (from CSV) into number format data.forEach(function(d) { d.health = +d.health; d.income = Math.log(+d.income); d.population = +d.population; console.log(d.population, Math.sqrt(d.population)) }); // set scales var x = D3.scale.linear() .domain([0, D3.max(data, function(d) {return d.income;})]) .range([0, 1000]); var y = D3.scale.linear() .domain([D3.min(data, function(d) {return d.health;}), D3.max(data, function(d) {return d.health; })]) .range([500, 0]); var size = D3.scale.linear() .domain([D3.min(data, function(d) {return d.population;}), D3.max(data, function(d) {return d.population; })]) .range([2, 40]); // append the chart to the website and set height&width var chart = D3.select("body") .append("svg:svg") .attr("width", 1000) .attr("height", 500) // draw the bubbles var g = chart.append("svg:g"); g.selectAll("scatter-dots") .data(data) .enter().append("svg:circle") .attr("cx", function(d,i) {return x(d.income);}) .attr("cy", function(d) return y(d.health);}) .attr("r", function(d) {return size(d.population);}); }); </script></body></html>
工具21:D3.js Templates
...nv.addGraph(function() { var chart = nv.models.scatter() //define that it's a scatterplot .xScale(D3.scale.log()) //log scale .pointRange([10, 5000]) //define bubble sizes .color(['black']); //set color D3.select('#chart') //select the p in which the chart should be plotted .datum(exampleData) .call(chart); //plot the chart return chart;});
工具22:Highcharts.js
<!DOCTYPE HTML><html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script src="https://code.highcharts.com/highcharts.js"></script> <script src="https://code.highcharts.com/modules/data.js"></script> <script src="https://code.highcharts.com/highcharts-more.js"></script> </head> <body> <p ></p> <script> var url = 'data.csv'; $.get(url, function(csv) { // A hack to see through quoted text in the CSV csv = csv.replace(/(,)(?=(?:[^"]|"[^"]*")*$)/g, '|'); $('#chart').highcharts({ chart: { type: 'bubble' }, data: { csv: csv, itemDelimiter: '|', seriesMapping: [{ name: 0, x: 1, y: 2, z: 3 }] }, xAxis: { type: "logarithmic" }, colors: ["#000000"], }); }); </script> </body></html>
工具23:Vega
{ "width": 1000, "height": 500, "data": [ { "name": "data", "url": "data.csv", "format": { "type": "csv", "parse": { "income": "number" } } } ], "scales": [ { "name": "xscale", "type": "log", "domain": { "data": "data", "field": ["income"] }, "range": "width", "nice": true, "zero": true }, { "name": "yscale", "type": "linear", "domain": { "data": "data", "field": ["health"] }, "range": "height", "zero": false }, { "name": "size", "type": "linear", "domain": { "data": "data", "field": "population" }, "range": [0,700] } ], "axes": [ { "type": "x", "scale": "xscale", "orient": "bottom" }, { "type": "y", "scale": "yscale", "orient": "left" } ], "marks": [ { "type": "symbol", "from": { "data": "data" }, "properties": { "enter": { "x": { "field": "income", "scale": "xscale" }, "y": { "field": "health", "scale": "yscale" }, "size": { "field":"population", "scale":"size", "shape":"cross" }, "fill": {"value": "#000"}, "opacity": {"value": 0.6} } } } ]}
工具24:Vega Lite
{ "data": {"url": "data.csv", "formatType": "csv"}, "mark": "circle", "encoding": { "y": { "field": "health", "type": "quantitative", "scale": {"zero": false} }, "x": { "field": "income", "type": "quantitative", "scale": {"type": "log"} }, "size": { "field": "population", "type": "quantitative" }, "color": {"value": "#000"} }, "config": {"cell": {"width": 1000,"height": 500}} }
工具25:BIT 超級數據分析平臺
END.
來源:數據君微信公眾datakong
本文由 貴州做網站公司 整理發布,部分圖文來源于互聯網,如有侵權,請聯系我們刪除,謝謝!
網絡推廣與網站優化公司(網絡優化與推廣專家)作為數字營銷領域的核心服務提供方,其價值在于通過技術手段與策略規劃幫助企業提升線上曝光度、用戶轉化率及品牌影響力。這...
在當今數字化時代,公司網站已成為企業展示形象、傳遞信息和開展業務的重要平臺。然而,對于許多公司來說,網站建設的價格是一個關鍵考量因素。本文將圍繞“公司網站建設價...
在當今的數字化時代,企業網站已成為企業展示形象、吸引客戶和開展業務的重要平臺。然而,對于許多中小企業來說,高昂的網站建設費用可能會成為其發展的瓶頸。幸運的是,隨...
蘋果13.1.2系統怎么樣?13.1.2較13.1.1運行流暢度并不復雜,發熱比13.1.1略大,好多外g始終就沒能修復,耗電應該差不多,其實,生級不你升級!有什么制作小視頻的手機軟件值得推薦?我確實是一點懂一點點,漸漸地梳理優酷打開程序中...怎樣剪輯音樂?有什么軟件推薦一下?謝謝邀請,音樂呀編輯時是拍攝和制作一部分。依據各位經驗適合初學者給你推薦推薦一款aec2.1英文版,功能全面上手簡單,如...
英文publisher什么意思?這不是一回事?!鞍l布者”是指發布者。Bookseller是指圖書銷售商publisher是一種高級的辦公軟件,可以進行文字處理并輸出PDFMicrosoft office publisher是publisher的全稱,是Microsoft發布的桌面出版應用程序。它通常被認為是一個入門級的桌面發布應用程序。它可以提供比Word更強大的頁面元素控制功能,但不如專業的頁面...
北京國家會議中心在什么地方?公交路線:地鐵4號線大興線地鐵2號線地鐵8號線,全程約23.4公里。1.從公益西橋乘坐地鐵4號線大興線,經過6站到達宣武門站。2.乘坐地鐵2號線,經過7站,到達鼓樓街站。3.乘坐地鐵8號線,經過4站,到達奧林匹克公園站(E出口)。4.步行約440米至國家會議中心。北京國家會議中心在什么地方?我想參加CP05伴侶節…但是不知道國家會議中心在哪里?地鐵可以直達嗎?我住的地方...