matlab 图例框去掉,[转载]matlab绘图中legend的终极用法,去掉legend的边框
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%持续更新。 当前:
20100108 %
%仅作笔记。 作者: keyflying %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
legend有时候挺烦人的,尽管大多时候挺好用。
基本数据:
data = rand(25)+repmat(1:25,25,1);
H = plot(data);
基本用法:
legend({'str1','str2','strn'});
高级用法1:指定legend显示的位置:
legend({'str1','str2','strn'},1);
legend({'str1','str2','strn'},2);
legend({'str1','str2','strn'},'Location','SouthEast');
可选的位置很多:
North:Inside plot box near top
South:Inside bottom
EastI:nside right
West:Inside left
NorthEast:Inside top right (default)
NorthWest:Inside top left
SouthEast:Inside bottom right
SouthWest:Inside bottom left
NorthOutside:Outside plot box near top
SouthOutside:Outside bottom
EastOutside:Outsideright
WestOutside:Outside left
NorthEastOutside:Outside top right
NorthWestOutside:Outside top left
SouthEastOutside:Outside bottom right
SouthWestOutside:Outside bottom left
Best:Least conflict with data in plot
BestOutside:Least unused space outside plot
通常,用'Best‘比较不错
高级用法2:指定显示某几条曲线的legend:
方法1:复杂到吐血
例如你有25条曲线,想显示其中1,6,11,16,21的legend,则
for i = [2:5 7:10 12:15 17:20 22:25]
set(get(get(H(i),'Annotation'),'LegendInformation'),'IconDisplayStyle','off');
end
legend('1','6','11','16','21');
方法2:简单到郁闷
H = plot(data);
legend(H([1 6 11 16 21],'1,'6','11’,'16','21');
高级用法3:legend横排
hl = legend(H([1 6 11 16 21],'1,'6','11’,'16','21');
set(hl,'Orientation','horizon')
高级用法4:不显示方框:
hl = legend(H([1 6 11 16 21],'1,'6','11’,'16','21');
set(hl,'Box','off');
参考文献
doc legend
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
legend('x','y')
legend('boxoff') 写两次就好了。我最初尝试着写成legend('x','y','boxoff')是不行的。
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
最好的说明文档,当然是帮助文档:
matlab:
doc legend
legend('hide'), legend(axes_handle,'hide') makes the legend in
the current axes or the axes specified by axes_handle
invisible.
legend('show'), legend(axes_handle,'show') makes the legend in
the current axes or the axes specified by axes_handle visible. A
legend is created if one did not exist previously. Legends created
automatically are limited to depict only the first 20 lines in the
plot; if you need more legend entries, you can manually create a
legend for them all with legend('string1','string2',...)
syntax.
legend('boxoff'), legend(axes_handle,'boxoff') removes the box
from the legend in the current axes or the axes specified by
axes_handle, and makes its background transparent.
legend('boxon'), legend(axes_handle,'boxon') adds a box with an
opaque background to the legend in the current axes or the axes
specified by axes_handle.
matlab 图例框去掉,[转载]matlab绘图中legend的终极用法,去掉legend的边框相关推荐
- matlab内存管理工具,[转载]MATLAB内存管理
今天用Matlab跑程序,由于数据量太大,又出现 Out of memory. Type HELP MEMORY for your options.的问题.看到这篇文章非常实用,转过来方便查阅~ 用 ...
- matlab imagesc参数设置,[转载]matlab 中imagesc的用法
imagesc(A) 将矩阵A中的元素数值按大小转化为不同颜色,并在坐标轴对应位置处以这种颜色染色 imagesc(x,y,A) x,y决定坐标范围,x,y应是两个二维向量,即x=[x1 x2],y= ...
- matlab的dft谱分析,[转载]Matlab中DFT在连续信号谱分析中的应用
本来是想用Matlab做通信课的模拟调制分析的,结果弄一个时频变换就吭哧了两三天时间,把原来的老底信号系统.DSP的书又翻出来看,总算稀里糊涂画出来了..... 所谓信号的谱分析,就是时频域转换,变成 ...
- matlab保存数据save,[转载]matlab中save,load使用方法
功能描述]存储文件 [软件界面]MATLAB->File->Save Workspace As将变量存入硬盘中指定路径. [函数用法] save:该函数将所有workspace中变量用二进 ...
- matlab 显示表格化,[转载]matlab窗口中显示excel表格的问题
刚刚在恒润论坛看到的,感觉还不错,跟踪中-- http://www.hirain.com/forum/dispbbs.asp?boardID=1&ID=301 % -------------- ...
- matlab极点怎么输入法,[转载]MatLab中的极点配置方法
在MATLAB中的极点配置函数有: ① acker函数: 用法为:k = acker(A,B,P). 其中,A.B为系统的状态空间模型矩阵,向量P中是期望的闭环极点位置,返回值是增益向量. ② pla ...
- matlab pcode 单步运行,[转载]Matlab中的profile工具
用profile可解决的问题: 1.避免不必要的计算 2.改动代码避免耗时的函数 3.储存一定的结果,避免重复计算 profile用作调试工具: 1.查找出没有实际运行的代码 2.You can al ...
- matlab 表格控件,[转载]matlab读取excel数据并显示在excel(activex控件)中
figure; spreadsheet = actxcontrol('OWC11.Spreadsheet.11',[0 0 560 420]); M = {'abc', 123; 12.17, log ...
- matlab gui修改图标,[转载]Matlab的GUI中左上角修改为自己想要的图标
有时候,自己做好的GUI界面,希望有自己的标志,一个很好的办法就是在GUI界面的左上角加上自己独有的图标:如自己的照片或者是自己学校的照片,下面以我们河海大学为例子说明: 修改方法如下: % GUI左 ...
- matlab 3个纵坐标,[转载]Matlab plotyy画双纵坐标图实例
Matlab plotyy画双纵坐标图实例 x = 0:0.01:20; y1 = 200*exp(-0.05*x).*sin(x); y2 = 0.8*exp(-0.5*x).*sin(10*x); ...
最新文章
- 定义一个有参宏SWAP(t,x,y),用以交换t类型的两个参数的值
- 1、Angular2 Component 组件
- zabbix------监控H3C MSR路由器
- 【量化交易】组合优化三部曲:换手率和alpha模型换手约束下的最优模型时变IC下的多空/多头最优组合换手率
- 11小时 python自动化测试从入门到_从设计到开发Python接口自动化测试框架实战,资源教程下载...
- 利用Relations实现多DataTable的聚合
- IIS无法启动——郁闷的KB939373补丁
- animation 循环_汽车前照灯与前雾灯热循环试验
- Matlab2014的下载和安装激活过程
- React项目本地环境正常显示,打包部署服务器图片不显示问题
- websocket传输数据大小限制_WebSocket传输超过126字节数据的方法
- 计算机 电脑 整机 加密,如何加密文件夹
- 操作系统课设详细解答
- strcmp, strncmp和memcmp的区别
- 名编辑电子杂志大师教程 | 设置电子杂志的高宽比例
- 新能源硫酸钠溶液除镍钴锰分离树脂技术
- C语言实现网络聊天室 socket的简单应用
- 微信小程序使用全套指南
- 怎么算程序框图的计算机程序,算法与程序框图导学案
- mysql安装完后不能配置_安装完 MySQL 后必须调整的 10 项配置
热门文章
- 计算机连接网络显示有限访问权限,电脑WiFi连接总是提示有限的访问权限是什么意思...
- [转帖]方正数码发布基于龙芯3A3000系列整机
- DS18B20温度传感器使用介绍
- Java中的String的getBytes()方法
- Flink 第8.2章 Flink 的键组 KeyGroup 与 缩放 Rescale
- 简述java工厂模式详解_JAVA 设计模式之 工厂模式详解
- 计算机与现代社会英语作文,高一英语作文,科技以下是题目:众所周知,科技在现代社会和生活中扮演着越来越重要的角色,但科技同时也是一把双刃剑,在它璀璨...
- 虚拟机如何使用计算机中文件,从电脑往虚拟机复制文件如何操作_怎么把电脑上东西复制到虚拟机...
- scrapy运行报错: Overridden settings XXX
- java.sql.SQLException: sql injection violation, syntax error: TODO QUES