2012-10-09 70 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)坐标。

相关问题