Read the help on image, imshow, imagesc, colormap, and colorbar functions.
I have no idea what you mean by tolerance and "gray factor," or "gray level plot of an image" for that matter. Do you want to plot a curve of image intensity (gray level) versus distance along some line (e.g. a particular row or column)? If so that would be like
plot(imageArray(rowToPlot, :));
or
plot(imageArray(:, columnToPlot));
Also, please check this out: http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer