added histogram visualization code