Matlab中绘制带箭头的坐标轴
2014-01-08 21:09
477 查看
转载自:http://blog.sina.com.cn/s/blog_6427cceb0100xnj9.html
方法一:
============================================================================
下面的程序虽然显示带箭头的坐标轴,但事实上并非真正的坐标轴,而是使用fill函数在两个直线段的终点填充了一个三角面而已。
Matlab 代码:
方法二:
===========================================================================
Matlab代码:
相关参数说明:
=====================================================================
PaperPosition
four-element rect vector
Location on printed page. Arectangle that determines the location of the figure on the printed page.Specify this rectangle with a vector of the form
rect = [left,bottom, width, height]
where left specifies the distance from theleft side of the paper to the left side of the rectangle and bottom specifiesthe distance from the bottom of the page to the bottom of the rectangle.Together these distances define the lower-left corner of the
rectangle. widthand height define the dimensions of the rectangle. The PaperUnits propertyspecifies the units used to define this rectangle.
也就是说PaperPosition是在打印页面上的位置
This example exports a figure at screen size to a 24-bitTIFF file, myfigure.tif.
set(gcf, 'PaperPositionMode', 'auto') % Use screen size
print -dtiff myfigure
PaperSize
PaperSize 向量[width,height]代表了用于打印的纸张尺寸,单位由PaperUnits属性指定
papersize是纸张大小;position要比size小的
axes1 = axes('Parent',figure1);
是指定figure1为axes1的父对象,所以axes1将会在figure1中显示出来。如果你不指定父对象,MATLAB就会自动把“当前figure”作为axes1的父对象。
If you want to make an axes the current axes withoutchanging the state of the parent figure, set the CurrentAxes property of thefigure containing the axes:
set(figure_handle,'CurrentAxes',axes_handle)
This command is useful if you want a figure to remainminimized or stacked below other figures, but want to specify the current axes
ANNOTATION creates an annotation object
ANNOTATION(ANNOTATIONTYPE)creates a default annotation of type
ANNOTATIONTYPE inthe current figure. ANNOTATIONTYPE maybe one of the following:
'rectangle'
'ellipse'
'textbox'
'line'
'arrow'
'doublearrow'= two headed arrow
'textarrow' =arrow with text at tail end
ANNOTATION('arrow',X,Y) creates an arrow annotation withendpoints specified in normalized figure coordinates by the vectors X and Y.
X(1) and Y(1) specify the position of the tail end of thearrow and X(2) and Y(2) specify the position at the tip of the arrow head.
方法一:
============================================================================
下面的程序虽然显示带箭头的坐标轴,但事实上并非真正的坐标轴,而是使用fill函数在两个直线段的终点填充了一个三角面而已。
Matlab 代码:
x=-5:10; y=-5:10; plot([0 0],[min(y),max(y)],'k',[min(x),max(x)],[0 0],'k'); axis off hold on ax=[max(x),max(x)-0.3,max(x)-0.3;0,0.2,-0.2]; fill(ax(1,:),ax(2,:),'k'); ay=[0,0.15,-0.15;max(y),max(y)-0.4,max(y)-0.4]; fill(ay(1,:),ay(2,:),'k');
方法二:
===========================================================================
Matlab代码:
x1=linspace(0,1,100); y1=x1.^2; figure1 = figure('PaperPosition',[0.6345 6.345 20.315.23],'PaperSize',[20.98 29.68]); axes1 = axes('Parent',figure1); hold(axes1,'all'); plot1 = plot(x1,y1); annotation1 = annotation(figure1,'arrow',[0.131 0.131],[0.920.96]); annotation2 = annotation(figure1,'arrow',[0.88 0.96],[0.1080.108]);
相关参数说明:
=====================================================================
PaperPosition
four-element rect vector
Location on printed page. Arectangle that determines the location of the figure on the printed page.Specify this rectangle with a vector of the form
rect = [left,bottom, width, height]
where left specifies the distance from theleft side of the paper to the left side of the rectangle and bottom specifiesthe distance from the bottom of the page to the bottom of the rectangle.Together these distances define the lower-left corner of the
rectangle. widthand height define the dimensions of the rectangle. The PaperUnits propertyspecifies the units used to define this rectangle.
也就是说PaperPosition是在打印页面上的位置
This example exports a figure at screen size to a 24-bitTIFF file, myfigure.tif.
set(gcf, 'PaperPositionMode', 'auto') % Use screen size
print -dtiff myfigure
PaperSize
PaperSize 向量[width,height]代表了用于打印的纸张尺寸,单位由PaperUnits属性指定
papersize是纸张大小;position要比size小的
axes1 = axes('Parent',figure1);
是指定figure1为axes1的父对象,所以axes1将会在figure1中显示出来。如果你不指定父对象,MATLAB就会自动把“当前figure”作为axes1的父对象。
If you want to make an axes the current axes withoutchanging the state of the parent figure, set the CurrentAxes property of thefigure containing the axes:
set(figure_handle,'CurrentAxes',axes_handle)
This command is useful if you want a figure to remainminimized or stacked below other figures, but want to specify the current axes
ANNOTATION creates an annotation object
ANNOTATION(ANNOTATIONTYPE)creates a default annotation of type
ANNOTATIONTYPE inthe current figure. ANNOTATIONTYPE maybe one of the following:
'rectangle'
'ellipse'
'textbox'
'line'
'arrow'
'doublearrow'= two headed arrow
'textarrow' =arrow with text at tail end
ANNOTATION('arrow',X,Y) creates an arrow annotation withendpoints specified in normalized figure coordinates by the vectors X and Y.
X(1) and Y(1) specify the position of the tail end of thearrow and X(2) and Y(2) specify the position at the tip of the arrow head.
相关文章推荐
- Matlab绘制带箭头坐标
- 在Matlab中根据离散点坐标绘制空间曲面
- 利用matlab在图形中绘制箭头
- MATLAB中绘制图形的时候,坐标和标题倒置
- Matlab绘制图像后在指定点绘制坐标线以及标注变量
- 在Matlab中根据离散点坐标绘制空间曲面
- MFC绘制坐标刻度和自定义线条以及带有箭头的直线
- 利用matlab如何在图形中绘制箭头
- 利用matlab如何在图形中绘制箭头
- MATLAB 根据X、Y坐标绘制折线图,增加右侧纵轴刻度且不用plotyy
- 月份信息二维坐标图绘制---(绘制箭头完美算法)续II
- matlab绘制曲面并标注坐标轴
- Matlab图像处理——在任意位置绘制二维箭头的总结
- MATLAB绘图基础02-双坐标轴绘制
- MFC绘制坐标刻度和自定义线条以及带有箭头的直线
- matlab画图:绘制双图,上图以条形图(分割开来的两根bar),下图是残差。。。横坐标为日期
- [ZZ] 用matlab绘制箭头
- Matlab绘制自然原点坐标的坐标轴
- Matlab手动绘制bounding box,并获取其坐标
- 【matlab】利用matlab在图形中绘制箭头、标注、圈圈 - 很帅很酷炫