# Specify color for each stocks (company)
colors <- c("#f87171", "#fb923c","#fbbf24", "#facc15",
"#a3e635","#4ade80","#34d399","#2dd4bf",
"#22d3ee","#38bdf8","#60a5fa","#818cf8",
"#a78bfa","#c084fc","#e879f9","#f472b6",
"#fb7185","#b91c1c","#b45309","#4d7c0f",
"#15803d","#0f766e","#0e7490","#4338ca",
"#fde68a","#bbf7d0","#bae6fd","#fbcfe8")
staticplot <- ggplot(df_finished, aes(rank,accumulated_volume/2, group = symbol)) +
# Create the bar chart
geom_tile(aes(y = accumulated_volume/2,
height = accumulated_volume,fill = as.factor(symbol),
width = 0.9), alpha = 0.8, color = NA) +
#Set the color of each bar according to the 'color' variable
scale_fill_manual(values = colors)+
#Set the xticker label
geom_text(aes(y = 0, label = paste(symbol, " "), color="white"), vjust = 0.2, hjust = 1,size=7) +
#Set the bar chart (accumulated volume label)
geom_text(aes(y=accumulated_volume,label = paste0(" ",accumulated_volume_text),color="white", hjust=0),size=4) +
coord_flip(clip = "off", expand = FALSE) +
#Add the logo of the company in each bar
geom_image(aes(image=image),size=0.05, asp=1.5) +
scale_y_continuous(labels = scales::comma) +
scale_x_reverse() +
guides(color = FALSE, fill = FALSE) +
custom_theme