2017-10-04 214 views
0

我試圖重現如下圖年趨勢:極座標圖:顯示

enter image description here

但我不知道是否確實可以創建這樣使用Python,R或一個的Tableau情節。 這裏是用我的第一次嘗試Plotly在R:

enter image description here

你有沒有建立這樣一個圖什麼建議嗎?

+0

爲什麼你換時間在極座標(缺少大小的圖例)?這只是...糟糕的 – EDi

+0

你可以使用matplotlib在Python中近似它。然而,在我看來,這需要付出相當大的努力,尤其是對那些對該產品不熟悉的人。 –

回答

0

您可以使用R和德包highcharter創建這樣一個情節:

spiderweb plot

情節js代碼則可以通過www/highcharts.com /演示/極地蜘蛛

0

當我正在用matplotlib創建這個圖時,有人提到我可以使用Excel創建這個圖表!在不到2分鐘的時間內,所以我沒有完成代碼,但無論如何,因爲我已經知道應該如何在matplotlib中創建不同的圖元,我將代碼放在這裏以防萬一任何人想要創建這樣的事情。

import matplotlib.pyplot as plt 
import matplotlib.patches as patches 

fig1 = plt.figure() 

#Adding grids 
for rad in reversed(range(1,10)): #10 is maximum of ranks we need to show 

    ax1 = fig1.add_subplot(111,aspect = 'equal') 
    ax1.add_patch(
    patches.RegularPolygon(
    (0,0), #center of the shape 
    11, #number of vertices 
    rad, 
     fill=False, 

     ls='--', 
    )) 
plt.xlim(xmin = -10,xmax=10) 
plt.ylim(ymin = -10,ymax=10) 
fig1.show() 

#plotting the trend 
plt.scatter(xs,ys) #xs = list of x coordinates, the same for ys 

for k in range(len(xs)-1): 
    x, y = [xs[k], xs[k+1]], [ys[k], ys[k+1]] 

    plt.plot(x, y,color = 'b') 

plt.grid(False) 

plt.show() 

Result plot

(正如我所說的代碼不會產生整體的趨勢,標籤,...但它幾乎是所有你需要創建情節)