graph updated for 3 dimensions