density estimation working and drawing