您的位置:首页 > 编程语言 > MATLAB

Matlab Plot 和 Line区别

2015-06-08 17:12 441 查看
Many MATLAB graphics functions call the object creation functions to draw graphics objects. However, high-level routines also clear the axes or create a new figure, depending on the settings of the axes and figure 
NextPlot
 properties.

Matlab图像函数请求对象创建函数画图像对象,但是,高级函数往往同时清除坐标轴或创建一幅新图像,取决于坐标轴的设置和图像的NextPlot属性。

In contrast, core object creation functions simply create their respective graphics objects and place them in the current parent object. They do not respect the settings of the figure or axes 
NextPlot
 property.

相反地,核心对象创建函数只创建它们各自的图像对象,把他们放在现有的父对象中,他们不管图像的设置或坐标轴的属性。

For example, if you call the 
line
 function,举例,如果请求Line
函数
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;"><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">line</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">(</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'XData'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">x</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'YData'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">y</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'ZData'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="pln" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">z</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'Color'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">,</span><span class="str" style="margin: 0px; padding: 0px; border: 0px; color: rgb(128, 0, 0);">'r'</span><span class="pun" style="margin: 0px; padding: 0px; border: 0px; color: rgb(0, 0, 0);">)</span></code>


MATLAB draws a red line in the current axes using the specified data values. If there is no axes, MATLAB creates one. If there is no figure window in which to create the axes, MATLAB creates it as well.

Matlab用给出的数据在现有的坐标系中画一条红色的线。如果还没有坐标轴,会创建一个。如果甚至还没有图像窗口,也会创建一个。

If you call the 
line
 function
a second time, MATLAB draws the second line in the current axes without erasing the first line. This behavior is different from high-level functions like 
plot
 that
delete graphics objects and reset all axes properties (except 
Position
 and 
Units
).
You can change the behavior of high-level functions by using the 
hold
 command
or by changing the setting of the axes 
NextPlot
 property.

但是!如果你再次请求line函数,MATLAB 在现有的坐标中画一条线,并不会擦除我们刚才画的那条。这与高级函数不同,如plot一样的高级函数,如果我们第二次请求,PLOT 会删除刚才的图像,重置坐标属性(除了Position和Units)。 你可以通过HOLD命令或改变坐标的NEXTPLOT属性设置来改变高级函数的这一行为。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: