声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 5263|回复: 9

[绘图技巧] PlotAxisAtOrigin

[复制链接]
发表于 2009-3-26 09:00 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
来自:http://blogs.mathworks.com
As an application engineer I showed MATLAB to a lot of people. Occasionally when I presented graphics capabilities someone would ask how to make plots where the X and Y axes lines go through the origin. You know: the way we learned to draw them in school. By default MATLAB puts the X axes on bottom and the Y axes on the left.
  1. x = -2*pi:pi/10:2*pi;
  2. y = sin(x);
  3. plot(x,y)
复制代码

                               
登录/注册后可看大图

While the xAxisLocation can be set to top, and the yAxisLocation can be right, neither has an origin option for example. So, instead, I usually suggested drawing lines through the origin. In fact, prior "Pick of the Week" star Brandon Kuczenski made that trivial with hline and vline.
  1. hline(0)
  2. vline(0)
复制代码

                               
登录/注册后可看大图

Not satisfied? Neither was Shanrong. Hence, PlotAxisAtOrigin.
  1. PlotAxisAtOrigin(x,y)
复制代码

                               
登录/注册后可看大图


代码: hline.m (3.03 KB, 下载次数: 57)
vline.m (2.97 KB, 下载次数: 47)
PlotAxisAtOrigin.m (1003 Bytes, 下载次数: 86)

评分

1

查看全部评分

回复
分享到:

使用道具 举报

发表于 2009-3-26 18:53 | 显示全部楼层
第一时间感觉似成相识, 刚刚有空找了下, 原来在官网!
而且本版亦多次讨论过, 可能楼主没见到! 还是感谢楼主的热心!

http://www.mathworks.com/matlabcentral/fileexchange/10473
如何改变坐标轴的位置?
http://forum.vibunion.com/forum/ ... =%D7%F8%B1%EA%D6%E1
请问matlab画二维图时,是否可以显示坐标轴的箭头?
http://forum.vibunion.com/forum/ ... =%D7%F8%B1%EA%D6%E1
 楼主| 发表于 2009-3-27 08:30 | 显示全部楼层
在这里没看见过,呵呵。而且我帖子已经注明出处了。
由于作图需要在官网找到,顺便就贴出来了。为了大家方便。
发表于 2009-3-27 15:09 | 显示全部楼层

回复 板凳 16443 的帖子

LZ别误会! 我有看到注明出处, 这是非常负责的态度, 钦佩!
借宝地列出连接主要是希望有一完整性
 楼主| 发表于 2009-3-27 19:26 | 显示全部楼层
我没什么误会的,呵呵。
您多心了。
发表于 2011-3-4 15:23 | 显示全部楼层
谢谢,但是就是看不了啊
发表于 2011-3-4 21:33 | 显示全部楼层
回复 6 # shijuyi 的帖子

什么叫“看不了”?
发表于 2011-6-24 10:35 | 显示全部楼层
感谢楼主,好东西
发表于 2012-1-6 15:10 | 显示全部楼层
thx for sharing
发表于 2013-1-10 15:03 | 显示全部楼层
谢谢分享 对我很有用
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-5-22 14:25 , Processed in 0.061330 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表