Skip to content
Prev 275109 / 398506 Next

stacked plot

Hi Dennis!

Fantastic, great, wonderful, beautiful.

I slightly changed your code to adapt it to my situation:

ggplot(DF.2, aes(x=file.name, y=value,
fill=codes))+geom_histogram(position="stack", stat="identity") +
labs(x="document", y="number of codings")

#######################
file.name codes value
---------------------------------
file.1   code.1 ?  2
file.1   code.2 ?  0
file.1   code.3 ?  0
file.1   code.4 ?  5
file.1   code.5 ?  4
file.2   code.1 ?  3
file.2   code.2 ?18
 ....

There are 126 bars (file1 -> file.126), so I should do the following:
(1) convert to a histogram with no gaps between the bars, and (2)
remove the labels at the bottom of each bar and just have
xlab="documents".

However, even with changing geom_bar to geom_histogram there are small
gaps between the bars.

Thanks for your help,

Henri-Paul