Matlab:不包含边界和工具栏的figure(移除保存图片的白边)
来源:互联网 发布:mac程序文件夹在哪里 编辑:程序博客网 时间:2024/06/05 08:11
Matlab启动时运行脚本'script.m',文件位置在~/matlab/ directory(windows下在matlab安装路径的bin目录下新建script.m译者注)。在该文件加上一行,或者在显示figure时加命令(下一行添加命令)
>>iptsetpref('ImshowBorder','tight');
图片即可显示,并且保存时没有白框。此方法仅仅适用'imshow'命令,不适用'imagesc'命令。
如果在'startup.m'文件中包含以下命令:
%在所有的figure去除菜单栏和工具栏
>>set(0,'DefaultFigureMenu','none');
%'disp'命令显示无空行
>>format compact;
这三条命令可以去除matlab默认的很多没有意义的显示信息。
翻译原文:http://www.shawnlankton.com/2007/06/matlab-figures-without-borders-and-toolbars/comment-page-1/#comment-2101
Something that has bothered me for *the entire* time I’ve used it is that when you show images using ‘imshow’ the resulting figure has the image surrounded in a sea of gray border. Well, I hate that gray border. It serves no purpose and today I have figured out how to remove it!
Matlab runs a script called ‘startup.m’ when it starts. This is located in your ~/matlab/ directory. If you include this line into that file (or just type it before you make the figure) then you remove the gray border:
>>iptsetpref('ImshowBorder','tight');
Its glorious… Now the picture scales to fill the whole window! (note this only works with the ‘imshow’ command, not ‘imagesc’).
BUT! That’s not all. I also learned about some other cute little tricks that should be included in your startup.m (if you’re me at least).
%removes menu and toolbar from all new figures
>> set(0,'DefaultFigureMenu','none');
%makes disp() calls show things without empty lines
>> format compact;
I feel like these three commands cut a lot of the pointless (inefficient) crap out of Matlab’s default display interface. Thanks to commenter Matt who pointed me toward the set(0,’Default… thing. You can use this to set up *tons* of settings so that you don’t have to set it every time. Just call:
>>set(0,'Default');
For some other useful tips on exporting figures for papers, check this related post.
- Matlab:不包含边界和工具栏的figure(移除保存图片的白边)
- Matlab:不包含边界和工具栏的figure(移除保存图片的白边)
- matlab保存figure中的图片去掉白边
- matlab保存figure中的图片去掉白边
- matlab保存figure中的图片去掉白边
- matlab保存figure中的图片去掉白边
- matlab保存figure中的图片去掉白边
- matlab 图片的读入和显示(imread函数和figure函数)
- 将matlab的figure保存为pdf,避免图片太大缺失
- Matlab中Figure高效保存为图片
- matlab figure的用法
- Matlab: figure的用法
- Matlab: figure的用法
- Matlab Figure 图形保存以及 Simulink 中 Scope 窗口坐标标注(label)的设置
- Matlab Figure 图形保存以及 Simulink 中 Scope 窗口坐标标注(label)的设置
- matlab的figure与java swing不兼容
- 设置matlab画出的figure图像导出图片的大小
- matlab保存figure
- Android自定义View之使用Path绘制手势轨迹和水波效果
- net-snmp开发过程整理-简介
- LeetCode160. Intersection of Two Linked Lists
- 理解泰勒公式·漫画
- Android 通用流行框架大全
- Matlab:不包含边界和工具栏的figure(移除保存图片的白边)
- 文件的创建、关闭及相关指令
- 最小二乘法及算法实现
- php 去掉图片的宽度、高度设置
- 安卓Retrofit post请求 带参数
- FTM下执行full test,进入camera test卡住,稍后手机重启
- 利用TCP/UDP完成文件传输的设计和实现
- JQuery 制作文字轮播
- Redis集群