function to compute and vis joint histogram