added download function for bar plot