I can't reproduce your issue with the code you have provided, Can you try again and provide a proper REPRoducible EXample (reprex)?
library(tidyverse)
library(data.table)
library(hrbrthemes)
data_filtered <- data.table(date = seq(as.Date('01-01-2020'), as.Date('10-01-2020'), by = '1 day'),
filling = 1:10,
idForLegend = c('id1', 'id2', 'id3', 'id4', 'id5', 'id6', 'id7', 'id8', 'id9', 'id10'))
data_filtered %>%
ggplot(aes(x = date, fill = idForLegend, y = filling)) +
geom_bar(position = "dodge", stat = 'identity') +
geom_hline(aes(yintercept = 5, linetype = 'Filling Threshold'), color='red', size=0.4) +
theme_ipsum(
grid = FALSE,
caption_margin = 1,
subtitle_margin = 1,
plot_title_margin = 1,
plot_margin = margin(1, 1, 1, 1)
) +
scale_color_manual(values = data_filtered$idForLegend) +
scale_fill_brewer(palette="Paired")
Created on 2020-11-18 by the reprex package (v0.3.0)