matlab 画图技巧
基本画图工具:matlab 画图中线型及颜色设置
**Matlab中的坐标轴设置技巧**
axisoff; %去掉坐标轴
axistight; %紧坐标轴
axisequal; %等比坐标轴
axis([-0.1, 8.1, -1.1, 1.1]); % 坐标轴的显示范围
x = -pi/2:0.01:pi;
plot(x,sin(x)) % 先绘制个基本图形
% gca: gca, h=figure(...);
set(gca, 'XLim',[-pi/2pi]); % X轴的数据显示范围
set(gca,'XTick',[-pi/2:pi/4:pi]); % X轴的记号点
set(gca,'XTickLabel',{'-pi/2' '-pi/4:' '0' 'pi/4' 'pi/2' 'pi*3/4''pi'}) % X轴的记号
set(gca,'XGrid','on'); % X轴的网格
set(gca,'XDir','reverse'); % 逆转X轴
set(gca,'XColor','red'); % X轴的颜色
set(gac,'Xscale','log') % x轴以log 形式显示 xlim(min,max)
matlab画图设置图片大小以及线宽和字号命令,该文章讲述了matlab画图设置图片大小以及线宽和字号命令.
set(gcf,'Units','centimeters','Position',[1010 7 5]); %设置图片大小为7cm×5cm
%get hanlde to current axis返回当前图形的当前坐标轴的句柄,
%(the first element is the relative distance of the axes to the left edge ofthe figure,...
%the second the vertical distance from the bottom, and then the width andheight;
set(gca,'Position',[.13 .17 .80 .74]); %设置xy轴在图片中占的比例
set(get(gca,'XLabel'),'FontSize',8); %图上文字为8 point或小5号
set(get(gca,'YLabel'),'FontSize',8);
set(get(gca,'TITLE'),'FontSize',8);
set(gca,'fontsize',8);
set(gca,'linewidth',0.5); %坐标线粗0.5磅
set(gca,'box','off');%Controls the box around the plotting area
set(get(gca,'Children'),'linewidth',1.5);%设置图中线宽1.5磅
设计图

代码
%% 普通的实现
%clear all;
% x=[8,16,32,64,128,256,512,1024,4096];
% y=[0.525,0.725,0.855,0.93,0.938,0.92,0.91,0.90,0.88];
% plot(x,y);
% xlabel('the number of reduced dimension')
% ylabel('mean average precision')
% axis([0 4100 0.5 1])
% %set(gca,'xticklabel',{'8','16','32','64','128','256','512','1024','4096'})
%% 技巧改进
clear all;
close all
x1={'8','16','32','64','128','256','512','1024','2048','4096'};
x=1:10;
y=[0.525,0.725,0.855,0.93,0.938,0.92,0.91,0.90,0.89,0.88];
figure
set(gcf,'color','w')
plot(x,y,'r.-','linewidth',2);
set(gca,'xticklabel',x1)
xlabel('the number of reduced dimension')
ylabel('mean average precision')
axis([0.5 10.5 0.5 1]) %左右留点余地
%设置网格线的线型,使用gridlinestyle属性,默认为虚线,可以改为实线
%axes('GridLineStyle', '-')
grid on
set(gca, 'GridLineStyle' ,'-')
set(gca,'xtick',[1,2,3,4,5,6,7,8,10]);
%set(gca,'XGrid','on');
%set(gca,'XTickMode','manual','XTick',[1,4,8,128,512,4096])
hold on
plot(x,y,'b.','markersize',20);
debug=1;
%saveas(gcf, 'E:\myfigure', 'eps') %保存为矢量图
%% 设计思路
% figure;
% clc;
% clear all;
% x = [1,5,13,30,48,77,100,142];
% ind=1:length(x);
% y1 =[1.3,2.1,3.6,4.7,7.8,8.0,8.3,8.1];
% y2 =[0.9,1.8,5.6,6.4,8.5,9.8,9.3,9.9];
%
% plot(ind,y1,'s-',ind,y2,'s-');
% set(gca,'XTick',ind);
% set(gca,'XTickLabel',{'1','5','13','30','48','77','','142'});
%)坐标轴的标尺属性:'Xtick','Ytick','Ztick'
%------ 标度的位置,值为向量'Xticklabel','Yticklabel','Zticklabel'
%------ 轴上标度的符号,它的值为与标度位置向量同样大
%用'xtick'属性设置x轴 刻度的位置
%用'xticklabel'来指定刻度的值,
- 结果

- 还有几个细节没有解决
matlab 画图技巧的更多相关文章
- Matlab画图,坐标轴范围设置和间隔设置
在Matlab画图的时候,系统默认的坐标轴范围以及间隔有时候并不是很合适,如何根据自己的要求来显示呢,Set语句就可以帮忙咯!! 1. set(gca,'xtick',0:100:2500) ...
- Matlab小技巧
记录一些用Matlab的技巧. //imshow全屏 subplot(1,3,3); imshow(topSketMat); hold on; set(gcf, 'units', 'normalize ...
- Matlab画图-非常具体,非常全面
Matlab画图 强大的画图功能是Matlab的特点之中的一个,Matlab提供了一系列的画图函数,用户不须要过多的考虑画图的细节,仅仅须要给出一些基本參数就能得到所需图形,这类函数称为高层画图函数. ...
- matlab提速技巧(自matlab帮助文件)
matlab提速技巧(自matlab帮助文件) 1.首先要学会用profiler.1.1. 打开profiler.To open the Profiler, select View -> Pro ...
- 设置 matlab 画图格式
1:设置 matlab 画图格式 clear;clc; % load("array.mat"); % Bestallarray=array; % rllofcircle(Besta ...
- 小论文matlab作图技巧
小论文matlab作图技巧 编辑->复制选项 编辑->图形属性 图中右击->字型 编辑->复制图片,即可. 效果: 宽:5.9高: 7.91
- 如何解决 Matlab 画图时中文显示乱码的问题?
使用的是win10系统,从前几个月某一天,我的matlab的figure里的中文都变成了口口.很是郁闷,还以为是动到了什么配置引起的. 前几天更新了matlab 2018b,发现还有这个问题.就觉得不 ...
- matlab 画图进阶
matlab 画图进阶 applications of matlab in engineering 图表类型的选择 first:advanced 2d plots special plots logl ...
- 20140513 matlab画图
1.matlab画图 x1=[1.00E-06,2.00E-06,4.00E-06,9.00E-06,2.00E-05,4.00E-05,8.00E-05,2.00E-04,4.00E-04,7.00 ...
随机推荐
- unix网络编程-配置unp.h头文件
第一步进入:www.unpbook.com,下载unp的随书代码.新建一个目录,将压缩包拷贝到这一目录下面,然后将压缩包直接解压:tar -zxvf 压缩包名.tar.gz 完成上一步后,进入到un ...
- 检查bug
用selective_search生成的坐标是(ymin,xmin,ymax,xmax),并且是从1开始的,不是从0 这是cache中的gt数据,明显看到有65535,说明很有可能是0-1变成了655 ...
- libcmt.lb libcmtd.lib与MSVCRTD.lib的冲突解决
system("pause"); 这个函数存在于MSVCRTD.lib库中: 当要使用system("pause")这个函数,且libcmt.lb libcmt ...
- 使用VS自带WCF测试客户端
打开VS自带WCF测试客户端 打开VS2015 开发人员命令提示 输入:wcftestclient,回车 提取wcftestclient 当然,可以看到VS2015 开发人员命令提示知道,当前路径在C ...
- VS2015安装SVN插件
一.下载VISUALlSVN 官网下载:地址 选择[VisualSVN for Visual Studio 2015 and older]的下载按钮下载,目前版本号VisualSVN 5.1.9,支持 ...
- Sqlserver查询结果集插入新表
数据库“Test” 数据库“Test2” 表 “fromTable” 表 “toTable” 表 “newTable” 字段 “name”,“age”,“gender” 原因:公司有2个数据库,一个是 ...
- 关于JVM内存模型,GC策略以及类加载器的思考
JVM内存模型 Sun在2006年将Oracle JDK开源最终形成了Open JDK项目,两者在绝大部分的代码上都保持一致.JVM的内存模型是围绕着原子性(操作有且仅有一个结果).可见性(racin ...
- 【04】Firebug页面概况查看
Firebug页面概况查看 使用Firebug的概况,你可以测试Web页面导致延迟加载的文件. 通过打开页面 Firebug > Console(控制台)> Profile(概况). 你需 ...
- cherrypy入门
主要是一个简单的cherrypy hello例子 import cherrypy from jinja2 import Environment, FileSystemLoader import os ...
- Leetcode39.Combination Sum组合总和
给定一个无重复元素的数组 candidates 和一个目标数 target ,找出 candidates 中所有可以使数字和为 target 的组合. candidates 中的数字可以无限制重复被选 ...