Question: [![enter image description here](https://i.stack.imgur.com/tVxUX.png)](https://i.stack.imgur.com/tVxUX.png)

I'm using ggplot and I get those weird horizontal lines out of geom\_bar. I cannot provide a minimal working example: the same code works with few observations and it relies on data I am importing and transforming. However, I can show the relevant line of codes and cross my fingers someone ran into this issue:

```
ggplot(data) + geom_bar(aes(x=Horizon, y=Importance, fill=Groups),
                           position='fill', stat='identity') +
theme_timeseries2() +
scale_fill_manual(values=c('#1B9E77', 'orange2', 'black', 
                           'red2', 'blue4')) +
xlab('') + ylab('')

```

My personal function, `theme_timeseries2()` isn't the source of the problem: it happens even if I stop after geom\_bar. I checked for missing values in `Importance` and every other column of my data frame and there are none.

It's also very odd: the white lines aren't the same on the zoomed page as in the plot window of RStudio. They do print in .png format when I save the file, so there really is something going on with those horizontal bars. Any theory about why `geom_bar()` does this would be highly appreciated.

Answer: 
You can fix it by adding the *fill* as *color*. Like this:

```
geom_bar(aes(x=Horizon, y=Importance, fill=Groups, color=Groups),
                       position='fill', stat='identity')

```

This was suggested [here](https://community.rstudio.com/t/lines-on-bars-in-graph-when-publishing-shiny/46580/3).
Mine went away when changing the size of the graphs in rmarkdown.