novice user here so please be kind and gentle! :)
I am dealing with the following dataset and R script:
#Create pvalue ranges
pvalue <- c(".000 - .005",".005 - .010",".010 - .015",".015 - .020",".020 - .025",".025 - .030",".030 - .035",".035 - .040",".040 - .045",".045 - .050")
#Create frequency counts
count <- c(5000,4000,3100,2540,2390,2260,2150,2075,2050,2025)
dat <- data.frame(pvalue = pvalue, count = count)
#Create plot
myPlot <- ggplot(data=dat, aes(x=pvalue, y=count, group=1)) +
geom_line() +
geom_point() +
geom_vline(xintercept=which(dat$pvalue == '.045 - .050'), linetype = "dashed") +
theme_bw() +
theme(axis.text.x = element_text(angle=90),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_blank()) +
theme(panel.border = element_blank()) +
ggtitle(paste("Insert Plot Title Here")) +
labs(x = "insert x-axis title here", y = "insert y-axis title here") +
theme(plot.title = element_text(lineheight=0.5,family = "TNR")) +
theme(axis.line.x = element_line(color="black"),
axis.line.y = element_line(color="black")) +
scale_y_discrete(breaks=NULL)
myPlot
The above dataset and R script produce the following plot:
An inspection of the image reveals that the left panel border (or the vertical axis) is missing. I want the left panel border to be included in the plot. However, I want to exclude the tick marks on the left panel border (or the vertical axis). Taken together, my desired plot would
- include a vertical line for the y-axis,
- include a horizontal line for the x-axis,
- remove tick marks along the y-axis (vertical axis)
- remove the top panel border
- remove the right panel border
The above R script takes care of #2-5 in this list. However, I have tried and tried and am unable to figure out how to take care of #1 in this list -- despite including the following in my R script:
theme(axis.line.x = element_line(color="black"),
axis.line.y = element_line(color="black")) +
Can somebody help me to produce the desired image? Very much appreciated :)
dat
is not created here so I we can't really help you without at least some data... – Dalesmandat <- data.frame(pvalue = pvalue, count = count)
– Fetid