0

enter image description here

In bar chart values are appearing incorrectly.How to correct it.

ggplot(data=df, aes(x=Demand_Supply,fill=time_slot),position = 'stack') +  
       geom_bar()  +  facet_wrap(~`Pickup.point`) + 
       geom_text(stat='count',aes(label=abs(..count..)))
Roman Luštrik
  • 67,056
  • 24
  • 151
  • 191
  • This is a duplicate- see here: https://stackoverflow.com/questions/39269895/labels-overlapping-on-stacked-bar-chart-ggplot2 – Connor Dibble Dec 14 '19 at 00:46

1 Answers1

0

You can control it using vjust and hjust.

Try following:

ggplot(data=df, aes(x=Demand_Supply,fill=time_slot),position = 'stack')+ geom_bar() + facet_wrap(~Pickup.point)+
geom_text(stat='count',aes(label=abs(..count..)), , vjust = -0.5)

you can try different permutation and combination with hjust and vjust.

Bhavesh Ghodasara
  • 1,777
  • 1
  • 12
  • 26