I am working on a graph whose x axis is state name and y axis is vote share, but on the x-axis I want both general election and state election data side by side per each state. However, in my output I can only see one bar and the other one is mixed inside it.
ggplot(BJP.voteshare.2019) +
geom_bar(aes(x = State_Name, y = voteshare.bjp.x), fill = "blue", stat = "identity", position = "dodge") +
geom_bar(aes(x = State_Name, y = voteshare.bjp.y), fill = "red", stat = "identity", position = "dodge") +
geom_text(aes(x = State_Name, y = voteshare.bjp.x, label = round(voteshare.bjp.x, 2)), vjust = -0.5, size = 3, color = "black", position = position_dodge(width = 0.8)) +
geom_text(aes(x = State_Name, y = voteshare.bjp.y, label = round(voteshare.bjp.y, 2)), vjust = -0.5, size = 3, color = "black", position = position_dodge(width = 0.8)) +
labs(title = "BJP Vote Share Comparison: State vs General Elections",
x = "State", y = "Vote Share (%)") +
scale_fill_manual(values = c("blue", "red"), labels = c("State Elections", "General Elections")) +
theme_minimal()

I'll invent some simple example data to simulate what you probably had (conclusion I dont see how it would all have been red ... ).
solution wise, I would say that ggplot2 is part of tidyverse, and so is opinionated on how the data should be arranged; it should be tidy. Therefore I tidy it, and show the more streamlined code, that also results in likely the desired chart. Hope it helps you .
1)