如何标注图形轴? [英] How can I label the graph axes?

查看:94
本文介绍了如何标注图形轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有绘制图形的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.

推荐答案

使用 xlabel ylabel .

生成情节后,执行以下操作:

After your plot has been spawned, do something like this:

xlabel('Time');
ylabel('Amplitude');

您在xlabelylabel的字符串中放置标签,它将在x轴(xlabel)或y轴(ylabel)上放置标签.将TimeAmplitude替换为您想要的任何内容.在执行此操作之前,请确保先显示您的图,以便将这些语句放在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆