Entering edit mode
9.0 years ago
Nitin
▴
170
I have following data
d1 d2
a -9.278
b -5.582
c -5.266
d -5.01
e -3.833
I wrote R code to plot barplot as follows
library(ggplot2)
dat<-read.csv("input.csv",sep=",")
dat1<-dat[,-3]
ggplot(dat11,aes(x = d1, y = d2)) +
geom_bar(fill="#e34a33",width=0.34,stat="identity") +
scale_x_discrete(limits=dat1$d1) +
coord_flip() +
theme_bw() + theme(legend.position = "none", panel.grid.major=element_blank(),
panel.grid.minor=element_blank(),legend.key =
element_blank(),axis.title.x = element_text(size=15),axis.text.x =
element_text(size=16), axis.title.y =
element_text(size=15),axis.text.y=element_text(size=17),
panel.border = element_rect(colour = "black",size=0.7))
This code gave the plot as follows
But this plot has problem bars are on right side but it should be towards left and x axis should start 0 to -10. Can any body to suggest soultions for this problem
Thanks, Sa