如何标注图形轴? [英] How can I label the graph axes?
问题描述
我有绘制图形的matlab代码.
I have matlab code that plots a graph.
x=0:1:6076*25;
w=7.8;
[X,Z] = ode45(@(t,Z) sys(t,Z,w),x,[2000 tand(7.8)]);
plot(X,Z(:,1),'r') %Z(:,1) is z(x) and Z(:,2) is z'(x).
如何标记轴?我想同时标注水平轴和垂直轴.
How can I label the axes? I'd like to label both the horizontal and the vertical axes.
推荐答案
生成情节后,执行以下操作:
After your plot has been spawned, do something like this:
xlabel('Time');
ylabel('Amplitude');
您在xlabel
和ylabel
的字符串中放置标签,它将在x
轴(xlabel
)或y
轴(ylabel
)上放置标签.将Time
和Amplitude
替换为您想要的任何内容.在执行此操作之前,请确保先显示您的图,以便将这些语句放在plot
命令之后.
You place in a string for xlabel
and ylabel
and it will place labels on either the x
-axis (xlabel
) or the y
-axis (ylabel
). Replace Time
and Amplitude
with whatever you wish. Make sure your plot is visible first before you do this, so you can place those statements after your plot
command.
If you'd like to add a title to your graph, you can also use the title
command too:
title('My Graph');
这篇关于如何标注图形轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!