I am trying to using ggplot2. The problem I faced there is labels of bars are up and down for each two bars of the graph. I would like to be each label on its own bar. I would like you to help me in fix this problem.
Also, I would like to know if there is a possibility to add "k$" to the label to each bar. I would like to know if there is a possibility to put the indicators (Actual and Budget) on the top of the graph.
This is my code:
library (ggplot2)
library(plotly)
library(readxl)
library(tidyverse)
df =read_excel("C:/Fall 2020 - Clarkson University/Information Visualization/Assignments/Assignment2/a2-DeptYearlyPerf.xls")
df2= df %>% pivot_longer(-Dept.,names_to="category", values_to="amount")
df3=df2 %>% separate(category,into=c("qtr","bud_or_act"),sep=" ")
df3 %>% ggplot(aes(x=qtr,y= amount,fill=bud_or_act, label= amount, width=.7)) +
geom_col(position="dodge") +facet_wrap(~Dept.) +
geom_text(size=3, position = position_stack(vjust = 0.5))