added a 3rd input to the function to handle the y-axis labels.