Reputation: 289
I want to draw a plot that displays y tick labels are similar to the below image. How can I do that?
thanks for your attentions
Upvotes: 1
Views: 2480
Reputation: 2725
labels = [' 1 ';'10 '; '100'];
set(gca,'YTickLabel',lbls);
This will set the YtickLabels to 1, 10 and 100. If you want LaTeX to interpret your ticklabels such that you will see (10⁰,10¹,10²), you can download this file from matlab exchange. http://www.mathworks.com/matlabcentral/fileexchange/15986
Upvotes: 1
Reputation: 8623
The y axis is setup as logarithmic.
you can create plots similar to this using
semilogy(xData,yData)
If you wanted the plot to look the same, you would of course need to use the semilogy to plot the data and then also add x and y axis labels using something like the following
xlabel('Fitness Evaluations');
ylabel('Error');
If you truly want to only show the powers of 10 on the y axis, meaning the power number, you can do something like as follows
labels = sort(str2num(get(gca,'YTickLabel')));
set(gca,'YTickLabel',labels);
Upvotes: 2