created function wrapper for barchart example

Can you move this outside of the function and pass the axes object in as the first argument?