Sean Simpson
2018-06-14 18:53:19 UTC
Hi, I have tried to get the bars of an uneven design to be the same width.
But when I change the width the spacing also changes and I am unsure how to
remedy the issue.
ggplot(Cg1, aes(fill=ST, y=OC, x=CT)) +
geom_blank() + theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor =
element_blank()) +
geom_bar(position="dodge", stat="identity", colour="black", size=.3) +
geom_errorbar(aes(ymin=OC-SE, ymax=OC+SE), width=.1, size=.1, # Width of
the error bars
position=position_dodge(.9)) +
scale_fill_manual(values =
c("#999999","#FFFFFF","#666666","#CCCCCC","#999999","#FFFFFF","#666666","#999999","#FFFFFF"),
name="",
breaks=c("SandyLoam", "SiltLaom", "Loam", "LoamySand",
"SandyLaom", "SiltLoam", "Loam", "SandyLoam", "SiltLoam"),
labels=c("Sandy Loam", "Silt Laom", "Loam", "Loamy
Sand", "Sandy Laom", "Silt Loam", "Loam", "Sandy Loam", "Silt Loam")) +
theme(legend.position = "bottom") +
theme(axis.text.x = element_text(color="#000000", size=12),
axis.text.y = element_text(color="#000000", size=12),
axis.ticks.x = element_blank()) +
scale_x_discrete(breaks=c("1SG","2MIS","3CAG"),labels=c("Switchgrass","Miscanthus","Conventional
Agriculture")) +
xlab("") + ylab("SOC (%)") + ggtitle("") + expand_limits(y=c(NA, 3.25))
Any help is greatly appreciated.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
But when I change the width the spacing also changes and I am unsure how to
remedy the issue.
ggplot(Cg1, aes(fill=ST, y=OC, x=CT)) +
geom_blank() + theme_bw() +
theme(panel.grid.major = element_blank(), panel.grid.minor =
element_blank()) +
geom_bar(position="dodge", stat="identity", colour="black", size=.3) +
geom_errorbar(aes(ymin=OC-SE, ymax=OC+SE), width=.1, size=.1, # Width of
the error bars
position=position_dodge(.9)) +
scale_fill_manual(values =
c("#999999","#FFFFFF","#666666","#CCCCCC","#999999","#FFFFFF","#666666","#999999","#FFFFFF"),
name="",
breaks=c("SandyLoam", "SiltLaom", "Loam", "LoamySand",
"SandyLaom", "SiltLoam", "Loam", "SandyLoam", "SiltLoam"),
labels=c("Sandy Loam", "Silt Laom", "Loam", "Loamy
Sand", "Sandy Laom", "Silt Loam", "Loam", "Sandy Loam", "Silt Loam")) +
theme(legend.position = "bottom") +
theme(axis.text.x = element_text(color="#000000", size=12),
axis.text.y = element_text(color="#000000", size=12),
axis.ticks.x = element_blank()) +
scale_x_discrete(breaks=c("1SG","2MIS","3CAG"),labels=c("Switchgrass","Miscanthus","Conventional
Agriculture")) +
xlab("") + ylab("SOC (%)") + ggtitle("") + expand_limits(y=c(NA, 3.25))
Any help is greatly appreciated.
--
--
You received this message because you are subscribed to the ggplot2 mailing list.
Please provide a reproducible example: https://github.com/hadley/devtools/wiki/Reproducibility
To post: email ***@googlegroups.com
To unsubscribe: email ggplot2+***@googlegroups.com
More options: http://groups.google.com/group/ggplot2
---
You received this message because you are subscribed to the Google Groups "ggplot2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ggplot2+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.