r - ggplot2 "geom_path requires the following missing aesthetics" -


i've been busy building scatterplot of shot chart data, , want draw basketball court behind it. have seen done on other stackoverflow questions, when replicating code cannot mine work.

i can run scatterplot seperately fine, , way it's set perfect. can run geom_path() statements separately fine if add "ggplot(data=data.frame(x=1,y=1),aes(x,y))+ top portion of geom_path statements, when try , put these getting error

the reason have inherit.aes=false in statements because "object "x.coord" not found" error getting prior 1 due geom_path statements inheriting ggplot statement.

chart.player <- ggplot(player5, aes(x =x.coord,y =y.coord , col = pts_att, size = log)) +   geom_point() + scale_colour_gradient("points/attempt", low = "green", high="red") + coord_fixed() +    ###outside box:   geom_path(data=outside_box,inherit.aes=false)+   ###solid ft semicircle above ft line:   geom_path(data=ft_semi_above,aes(x=x,y=y),inherit.aes=false)+   ###dashed ft semicircle below ft line:   geom_path(data=ft_semi_below,aes(x=x,y=y),linetype='dashed',inherit.aes=false)+   ###key:   geom_path(data=key,inherit.aes=false)+   ###box inside key:   geom_path(data=box_key,inherit.aes=false)+   ###restricted area semicircle:   geom_path(data=ra_semi,aes(x=x,y=y),inherit.aes=false)+   ###halfcourt semicircle:   geom_path(data=half_semi,aes(x=x,y=y),inherit.aes=false)+   ###rim:   geom_path(data=rim,aes(x=x,y=y),inherit.aes=false)+   ###backboard:   geom_path(data=backboard,lineend='butt',inherit.aes=false)+   ###three-point line:   geom_path(data=threept,aes(x=x,y=y),inherit.aes=false)  plot(chart.player) error: geom_path requires following missing aesthetics: x, y 

any appreciated! thanks


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -