user7193634 user7193634 - 1 year ago 124
R Question

Stacked barplot of small data set in R

I have a a file which contains two lists: with names in first column and numbers in secound column.

I would like to make a bar plot with names on x-axis and numbers on y-axis.

I used melt(mydata) and got a file with 3 columns: V1 (names) variable (V2) value (number)

Then I tried

ggplot(dat, aes(x = "V1", y= "value", fill = "variable")) + geom_bar(stat="identity")

The I got: Stacked barplot

Any ideas where I go wrong?

Answer Source

You're over complicating it:

ggplot(dat, aes(V1, value)) + geom_bar(stat = "identity")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download