library(ggplot2)

nba_data<- read.csv('C:/Users/werol/Downloads/NBAstats/nba_stats.csv')
#head(nba_data)

nba_data_3 <- subset(nba_data, Year>1979)
#head(nba_data_3)

three_point <- ggplot(data = nba_data_3, mapping = aes(x = X3P.,y = X3PA, color = Player)) +
               geom_point(alpha = .5) +
               scale_colour_manual(values = c(
                "Stephen Curry" = "green", 
                "James Harden" = "red", 
                "Klay Thompson" = "blue")) +
               scale_alpha_manual(values = c(
                "Stephen Curry" = 1,
                "James Harden" = 1,
                "Klay Thompson" = 1)) +
               scale_size_manual(values = c(
                 "Stephen Curry" = 4,
                 "James Harden" = 4,
                 "Klay Thompson" = 4)) +
               xlab("3-point percentage") +
               ylab("3-point attempts") + 
               theme_classic() + 
               ggtitle("3-point Shooting Numbers for Every Player Across Every Season",
               subtitle = "Curry, Harden, and Thompson only players with multiple seasons above 625 attempts and 37.5% success rate") +                     
               scale_fill_grey()


three_point
## Warning: Removed 3511 rows containing missing values (geom_point).

#three_point_year <- three_point + facet_wrap(~Year)
#three_point_year

outliers <- subset(nba_data_3, X3PA>625, X3P.>.375)
outliers
##           X Year             Player Pos Age  Tm  G GS   MP  PER   TS. X3PAr
## 12592 12591 1996     George McCloud  SF  28 DAL 79 63 2846 15.9 0.543 0.529
## 12724 12723 1996       Dennis Scott  SF  27 ORL 82 82 3041 16.1 0.589 0.562
## 15974 15973 2002     Antoine Walker  PF  25 BOS 81 81 3406 17.1 0.490 0.382
## 17512 17511 2005 Quentin Richardson  SG  24 PHO 79 78 2839 13.6 0.522 0.604
## 17666 17665 2006          Ray Allen  SG  30 SEA 78 78 3022 22.2 0.590 0.435
## 23001 23000 2015      Stephen Curry  PG  26 GSW 80 80 2613 28.0 0.638 0.482
## 23634 23633 2016      Stephen Curry  PG  27 GSW 79 79 2700 31.5 0.669 0.554
## 23723 23722 2016       James Harden  SG  26 HOU 82 82 3125 25.3 0.598 0.406
## 24034 24033 2016      Klay Thompson  SG  25 GSW 80 80 2666 18.6 0.597 0.469
## 24217 24216 2017      Stephen Curry  PG  28 GSW 79 79 2638 24.6 0.624 0.547
## 24291 24290 2017        Eric Gordon  SG  28 HOU 75 15 2323 13.1 0.557 0.651
## 24307 24306 2017       James Harden  PG  27 HOU 81 81 2947 27.3 0.613 0.493
## 24613 24612 2017      Isaiah Thomas  PG  27 BOS 76 76 2569 26.5 0.625 0.439
## 24618 24617 2017      Klay Thompson  SG  26 GSW 78 78 2649 17.4 0.592 0.470
##         FTr ORB. DRB. TRB. AST. STL. BLK. TOV. USG. blanl  OWS  DWS   WS WS.48
## 12592 0.175  3.9 10.6  7.0 12.5  2.0  0.9 10.7 22.6    NA  4.2  1.6  5.8 0.098
## 12724 0.199  2.5  9.2  5.9 12.4  1.5  0.7  9.1 19.9    NA  6.4  2.4  8.8 0.138
## 15974 0.192  4.7 18.6 11.5 22.8  1.9  0.9 12.1 27.8    NA  1.5  5.2  6.7 0.094
## 17512 0.176  3.6 13.9  9.0  7.9  1.7  0.6  8.3 18.9    NA  3.3  2.5  5.8 0.098
## 17666 0.239  2.8 10.6  6.6 17.2  1.8  0.4 10.2 27.4    NA  9.8 -0.3  9.5 0.150
## 23001 0.251  2.4 11.4  7.0 38.6  3.0  0.5 14.3 28.9    NA 11.5  4.1 15.7 0.288
## 23634 0.250  2.9 13.6  8.6 33.7  3.0  0.4 12.9 32.6    NA 13.8  4.1 17.9 0.318
## 23723 0.518  2.2 15.6  8.8 35.4  2.2  1.4 15.9 32.5    NA 10.7  2.6 13.3 0.204
## 24034 0.159  1.5 10.3  6.2  9.8  1.1  1.4  8.5 26.3    NA  5.4  2.6  8.0 0.144
## 24217 0.251  2.7 11.4  7.3 31.1  2.6  0.5 13.0 30.1    NA  8.6  3.9 12.6 0.229
## 24291 0.172  1.4  8.1  4.7 12.3  1.0  1.4 10.0 22.1    NA  2.5  1.4  3.8 0.079
## 24307 0.575  3.5 20.9 12.2 50.7  2.0  1.0 19.5 34.2    NA 11.5  3.6 15.0 0.245
## 24613 0.441  1.9  7.0  4.4 32.6  1.4  0.4 10.7 34.0    NA 10.9  1.6 12.6 0.235
## 24618 0.158  2.2  9.2  5.9  9.3  1.2  1.2  8.0 26.1    NA  4.2  2.9  7.1 0.128
##       blank2 OBPM DBPM  BPM VORP  FG  FGA   FG. X3P X3PA  X3P. X2P X2PA  X2P.
## 12592     NA  2.6 -1.4  1.3  2.3 530 1281 0.414 257  678 0.379 273  603 0.453
## 12724     NA  3.6 -1.3  2.3  3.3 491 1117 0.440 267  628 0.425 224  489 0.458
## 15974     NA  1.8  1.2  3.0  4.3 666 1689 0.394 222  645 0.344 444 1044 0.425
## 17512     NA  2.0 -0.1  1.9  2.8 407 1045 0.389 226  631 0.358 181  414 0.437
## 17666     NA  6.7 -3.1  3.6  4.2 681 1500 0.454 269  653 0.412 412  847 0.486
## 23001     NA  9.6  0.3  9.9  7.9 653 1341 0.487 286  646 0.443 367  695 0.528
## 23634     NA 12.4  0.1 12.5  9.8 805 1598 0.504 402  886 0.454 403  712 0.566
## 23723     NA  7.1 -0.4  6.7  6.9 710 1617 0.439 236  657 0.359 474  960 0.494
## 24034     NA  2.9 -2.2  0.7  1.8 651 1386 0.470 276  650 0.425 375  736 0.510
## 24217     NA  7.7 -0.4  7.3  6.2 675 1443 0.468 324  789 0.411 351  654 0.537
## 24291     NA  1.0 -2.4 -1.4  0.4 412 1016 0.406 246  661 0.372 166  355 0.468
## 24307     NA  8.7  1.5 10.1  9.0 674 1533 0.440 262  756 0.347 412  777 0.530
## 24613     NA  8.8 -3.3  5.5  4.8 682 1473 0.463 245  646 0.379 437  827 0.528
## 24618     NA  2.4 -2.1  0.3  1.5 644 1376 0.468 268  647 0.414 376  729 0.516
##        eFG.  FT FTA   FT. ORB DRB TRB AST STL BLK TOV  PF  PTS
## 12592 0.514 180 224 0.804 116 263 379 212 113  38 166 212 1497
## 12724 0.559 182 222 0.820  63 246 309 243  90  29 122 169 1431
## 15974 0.460 240 324 0.741 150 564 714 407 122  38 251 237 1794
## 17512 0.498 136 184 0.739  91 388 479 158  96  27 102 197 1176
## 17666 0.544 324 359 0.903  71 261 332 286 105  16 188 151 1955
## 23001 0.594 308 337 0.914  56 285 341 619 163  16 249 158 1900
## 23634 0.630 363 400 0.908  68 362 430 527 169  15 262 161 2375
## 23723 0.512 720 837 0.860  63 438 501 612 139  51 374 229 2376
## 24034 0.569 193 221 0.873  35 271 306 166  60  49 138 152 1771
## 24217 0.580 325 362 0.898  61 292 353 523 143  17 239 183 1999
## 24291 0.527 147 175 0.840  29 172 201 188  48  40 121 150 1217
## 24307 0.525 746 881 0.847  95 564 659 906 120  37 464 215 2356
## 24613 0.546 590 649 0.909  43 162 205 449  70  13 210 167 2199
## 24618 0.565 186 218 0.853  49 236 285 160  66  40 128 139 1742