Change scale of x-axis on plot
55 次查看(过去 30 天)
显示 更早的评论
Hi, my code plots 3 lines onto one plot
The x-axis scale is very big, 0 to 40,000, while the y axis is very small (between +/- 0.06)
When I do my plot the x-axis shows the scale 0 to 4, (x 10^4). How do I change it so that it simply says 0 to 40,000 instead?
Thank you!
0 个评论
回答(3 个)
Joseph Cheng
2021-11-9
check this answers post here:
there are different methods posted there that should work for you
0 个评论
Mathieu NOE
2021-11-9
hello Megan
you have to create a specific XTick / XTickLabel to represent the number the way you prefer
here an example with 5 values of the x data vector used to create the new XTick / XTickLabel
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/795404/image.png)
x = (0:40e3);
y = randn(size(x))*0.02;
N = 5;
xt = linspace(min(x),max(x),N);
XtLabels = num2cell(xt);
plot(x,y);
set(gca,"XTick",xt,"XTickLabel",XtLabels);
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!