Hello all...working on a project here and my code is below....few questions..
How can I add labels to the X axis bins? Below each bin I'd like for them to say 0.0-1.0, 1.1-2.0, etc...
How can I add percents and total counts to the TOP of these bins on the histogram?
I'm not summing anything up on the Y axis. Is there a way to remove the Y axis counts? As you can see from my graph label below I don't want anything there but count is being added my default.
library(ggplot2)
library(dplyr)
library(base)
library(dplyr)
library(tidyverse)
WAR <- read.csv("WAR.csv")
View(WAR)
## Only Pitchers displayed in a DF
pitchers <- filter(WAR, Type == "Pitcher")
View(pitchers)
##2020 pitchers only
pitchers20 <- filter(pitchers, year == 2020)
View(pitchers20)
##2021 pitchers only
pitchers21 <- filter(pitchers, year == 2021)
View(pitchers21)
##Only Hitters displayed in a DF
hitters <- filter(WAR, Type == "Hitter")
##2020 hitters only
hitters20 <- filter(hitters, year == 2020)
##2021 hitters only
hitters21 <- filter(hitters, year == 2021)
##2020 all WAR
WAR20 <- filter (WAR, year ==2020)
#2021 all WAR
WAR21 <- filter( WAR, year == 2021)
#2021 WAR histogram with custom bins and scales
ggplot(WAR21, aes(x=WAR))+
geom_histogram(fill='steelblue', col='black', bins=12)+
labs(title = "2021 MLB fWAR Distribution, No PA/IP Minimums")+
scale_x_continuous(breaks = seq(-2.,8.5, by = 1.00))+
ylab ("NA dont want a Y axis")+
xlab("fWAR")+
theme(axis.title.y = element_text(color="#993333", size=13, face="bold"))+
theme(axis.title.x = element_text(color="#993333", size=13, face="bold"))+
theme(plot.title = element_text(color="Dark Red", size=14, face="bold.italic"))+
theme(axis.text.x = element_text(color = "dark red", size = 9, face ="bold"))
##above how do I label them 0-1, 1-2, etc. on the X axis?```