How to put a constant multiple along y-axis in the plot window?
8 views (last 30 days)
Show older comments
I want to plot a 2D graph with two-vectors which I do like this:
plot(x,y)
However, in the plot window, I want the y-axis to be shown to be multiplied by a constant factor e.g. 1000. So, it just plots x versus y but at the top of y-axis, puts a text "x 1000".
0 Comments
Answers (2)
Azzi Abdelmalek
on 13 Nov 2013
Edited: Azzi Abdelmalek
on 13 Nov 2013
%Example
t=0:0.1:10;
y=sin(t);
plot(t,y)
cst=1000
old_Yticks=get(gca,'ytick')
new_Yticklabel=arrayfun(@num2str,old_Yticks*cst,'un',0);
set(gca,'yticklabel',new_Yticklabel)
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!