tidyverse / ggplot2

An implementation of the Grammar of Graphics in R
https://ggplot2.tidyverse.org
Other
6.55k stars 2.03k forks source link

Problem with horizontal lines in geom_bar #4708

Closed VitorBSP closed 2 years ago

VitorBSP commented 2 years ago

Hello Everybody! I'm developing an R markdown document with geom_bar graphs, but I have a little problem, with horizontal lines, like blocks, in my graphs design.

I have a df like this: Grupo Valor
Documentação 275
Documentação 56
Documentação 275
Documentação 56
Documentação 350

And my code is:

bar_g2<-function(data, y, x,category, manual_fill){
  data %>% 
  ggplot() + 
  geom_bar(aes(y={{y}}, x = {{x}}, fill = {{category}}), stat='identity') + scale_fill_manual(values={{manual_fill}})
}
bar_g2(Des_Grupo, Valor, Grupo, Grupo, gt)

So, the graphs is like this

But I want the graphs is like this: (without horizontal lines)

VitorBSP commented 2 years ago

I noticed I have one graph without this horizontal lines

But for this graphs I used group_by, so I tested for the other plor and it works too

Have a more simple way?

clauswilke commented 2 years ago

Hello, please ask your question over on the RStudio Community or on Stackoverflow. The ggplot2 issue tracker is not meant for user support. It's only for genuine bugs in the code and for feature requests.