Grouped barplot

Hi there!
I'm new to R, but I'm doing grouped bar plots to show the partisan composition of legislatures. In the attached example, I divided each party by how many MPs it has in the upper and lower chambers.
However, there are a few parties which have representatives in only one chamber (e.g, PCH only has in the Chamber of Deputies and not in the Senate). Given that, its bar is wider than the others --it has the double size--, while the Deputies bar should remain with the same width and the Senators bar be "0".

How can I solve this?
I appreciate your comments in advance!

PS: I used the following code:

Blockquote

require(ggplot2)
data(data)
head(data)
ggplot(data, aes(Party, fill=Chamber)) +
geom_bar(position= "dodge") +
scale_colour_discrete_qualitative() +
labs(x= "Political party",
y = "Count",
title = "Paraguayan Congress' composition",
subtitle = "2013 elections") +
theme_bw()

Blockquote

In the call to geom_bar, try using

geom_bar(position = position_dodge2(preserve = "single"))
1 Like

Much appreciated! It worked

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.