I was looking for it here in Stack Overflow as in Google, and I found a lot of packages to draw, but it seems a complex task, so I would like to know which is the most appropriate package to draw bars, and associate data to it. Also I was looking for a code example, but I did not have luck.
That sounds like an easy job for the pgfplots
package. Section 4.4.4 contains a lot of examples to start from, everything is explained from scratch and step-by-step. If you need more pgfplots
examples, the section dedicated to plots at TeXample could be of interest. There aren't any bar plots, but it contains some nice (and more elaborate) examples of the functionality.
As for a code example, I could copy-and-paste one from the manual, but that would not add much to this post I believe.
Edit: when using Matlab, it is possible to use matlab2tikz
. This way you can export your plots without having to worry about the actual code. Bar charts should be possible, but I haven't used that functionality yet so I don't know about any quirks. The plots I did export using this Matlab script were perfect and you get the consistency and flexibility you want :).
This might be viewed as sacrilege, but it's actually not that terrible to generate the plot using matlab, excel or any other tool, and merely include the PDF/jpg in. pgfplots is a more elegant option, but might not be the quickest.