2012-10-09 37 views
10

我正在製作籃球的拍攝圖表。我需要弄清楚如何在背景中真實地畫出籃球場的輪廓。有任何想法嗎?如何在ggplot的背景中繪製某些東西?

enter image description here

enter image description here

enter image description here

+0

看看'annotate_raster'或類似的東西。 – mnel

+0

很酷的問題。如果你知道如何佈置籃球場,你可以用+ geom_path(data = )'做些什麼。檢查http://stackoverflow.com/questions/9805895/mapping-the-world-on-ggplot2的想法(用'geom_path'替換'geom_polygon')。 – naught101

+0

@ naught101謝謝!我知道了。 –

回答

7

enter image description here

下面的代碼來得到這個圖片:

 

    ggplot(shots, aes(X,Y)) + stat_binhex(binwidth=c(3,3)) + 
    geom_point(size=3, alpha=0.5, aes(color=RESULT), position="jitter") + 
    coord_equal() + theme_grey() + opts(title="Golden State Warriors 2012 Shot Chart") + 
    geom_path(data=ft_line, aes(x,y), colour="white", size=2) + 
    geom_path(data=court, aes(x,y), colour="white", size=2) 

中的數據geom_path命令包含白色法院圖的(x,y)座標。

相關問題