当前位置: 首页 > news >正文

Matlab中绘制带箭头的坐标轴

转载自:http://blog.sina.com.cn/s/blog_6427cceb0100xnj9.html

方法一:

============================================================================

下面的程序虽然显示带箭头的坐标轴,但事实上并非真正的坐标轴,而是使用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删除cell数组中全为NaN的行和列
  • Ubuntu环境变量PATH设置
  • 【MLF Week 7 上】Overfitting和Regularization
  • Windows 7 下查询设备详细信息
  • Windows 7 英文版操作系统中文软件乱码解决方法
  • 如何彻底删除QQ程序
  • Windows 7时间设置问题
  • Ubuntu下载精美壁纸
  • 如何关闭Microsoft Office上载中心
  • Ubuntu安装google-chrome浏览器
  • Matlab中的匿名函数的使用
  • 搜狗输入法如何输入直角引号(「『』」 )
  • Python学习笔记(1)
  • Ubuntu修改磁盘分配空间
  • 机器学习入门
  • JS中 map, filter, some, every, forEach, for in, for of 用法总结
  • 【跃迁之路】【733天】程序员高效学习方法论探索系列(实验阶段490-2019.2.23)...
  • C++类中的特殊成员函数
  • CSS选择器——伪元素选择器之处理父元素高度及外边距溢出
  • ECMAScript入门(七)--Module语法
  • ECS应用管理最佳实践
  • Java方法详解
  • java概述
  • ng6--错误信息小结(持续更新)
  • Python打包系统简单入门
  • python大佬养成计划----difflib模块
  • tab.js分享及浏览器兼容性问题汇总
  • Travix是如何部署应用程序到Kubernetes上的
  • Yeoman_Bower_Grunt
  • 基于HAProxy的高性能缓存服务器nuster
  • 码农张的Bug人生 - 见面之礼
  • 它承受着该等级不该有的简单, leetcode 564 寻找最近的回文数
  • 协程
  • HanLP分词命名实体提取详解
  • ​Linux·i2c驱动架构​
  • ​Spring Boot 分片上传文件
  • ​决定德拉瓦州地区版图的关键历史事件
  • #AngularJS#$sce.trustAsResourceUrl
  • #Js篇:单线程模式同步任务异步任务任务队列事件循环setTimeout() setInterval()
  • (12)Linux 常见的三种进程状态
  • (MATLAB)第五章-矩阵运算
  • (poj1.2.1)1970(筛选法模拟)
  • (Redis使用系列) Springboot 在redis中使用BloomFilter布隆过滤器机制 六
  • (独孤九剑)--文件系统
  • (附源码)spring boot火车票售卖系统 毕业设计 211004
  • (附源码)ssm高校升本考试管理系统 毕业设计 201631
  • (利用IDEA+Maven)定制属于自己的jar包
  • (三)c52学习之旅-点亮LED灯
  • (原創) 是否该学PetShop将Model和BLL分开? (.NET) (N-Tier) (PetShop) (OO)
  • (转)Android学习系列(31)--App自动化之使用Ant编译项目多渠道打包
  • ***原理与防范
  • .net mvc部分视图
  • .NET 常见的偏门问题
  • .NET开发人员必知的八个网站
  • /etc/fstab和/etc/mtab的区别