adding codes function to plotting and bin plotting function [like hist but for discrete bins]