I'm relatively new to ggplot2. I'm trying to make a bar graph, but my x axis gets squashed. The resulting graph is attached as a pdf. Any idea on how I can get rid of the extra white space on the right side of the graph?
### GET SUMMARY STATISTICS TO MAKE GRAPHS
LOCO <- summarySE(LOCO_BT, measurevar="Diff_BC", groupvars=c("Genotype","DUM_Dose"), na.rm = TRUE)
LOCO
### CREATE A SHORT CUT TO MAKE BLACK/WHITE GRAPHS
BW_Graphs <- theme_bw()+
theme(
plot.background = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.border = element_blank()) +
theme(axis.line = element_line(color = 'black'))
### GRAPH WITH MEAN +/- SEM
ggplot(LOCO, aes(x=DUM_Dose, y=Diff_BC, fill=(factor(C57_LOCO$Genotype, levels=c("WT", "HET", "KO"))))) +
geom_bar(position=position_dodge(.9),
stat="identity",
colour="black", # Use black outlines,
size=.3) +
scale_fill_manual(breaks=c("WT", "HET", "KO"),
values=c("white", "gray", "black"),
name="Genotype") +
geom_errorbar(aes(ymin=Diff_BC-se, ymax=Diff_BC+se), # Need to change for future graphs to variable of interest eg Diff_BC
size=.3, #Thinner lines
width=.2, # Width of the error bars
position=position_dodge(.9)) +
xlab("Dose") +
ylab("Beam Crosses") +
ggtitle("Activity") +
scale_y_continuous (limits=c(-125, 25), expand = c(0, 0)) +
scale_x_discrete(breaks=c("1", "2", "3"), labels=c("0.25", "0.5", "1.0"))+
BW_Graphs
Genotype DUM_Dose N Diff_BC sd se ci
1 HET 1 16 -20.250000 48.78046 12.195115 25.99327
2 HET 2 15 -69.133333 43.72947 11.290901 24.21657