implemented specifying number of data to plot