**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 画图技巧的更多相关文章

  1. Matlab画图,坐标轴范围设置和间隔设置

    在Matlab画图的时候,系统默认的坐标轴范围以及间隔有时候并不是很合适,如何根据自己的要求来显示呢,Set语句就可以帮忙咯!! 1. set(gca,'xtick',0:100:2500)      ...

  2. Matlab小技巧

    记录一些用Matlab的技巧. //imshow全屏 subplot(1,3,3); imshow(topSketMat); hold on; set(gcf, 'units', 'normalize ...

  3. Matlab画图-非常具体,非常全面

    Matlab画图 强大的画图功能是Matlab的特点之中的一个,Matlab提供了一系列的画图函数,用户不须要过多的考虑画图的细节,仅仅须要给出一些基本參数就能得到所需图形,这类函数称为高层画图函数. ...

  4. matlab提速技巧(自matlab帮助文件)

    matlab提速技巧(自matlab帮助文件) 1.首先要学会用profiler.1.1. 打开profiler.To open the Profiler, select View -> Pro ...

  5. 设置 matlab 画图格式

    1:设置 matlab 画图格式 clear;clc; % load("array.mat"); % Bestallarray=array; % rllofcircle(Besta ...

  6. 小论文matlab作图技巧

    小论文matlab作图技巧 编辑->复制选项 编辑->图形属性 图中右击->字型 编辑->复制图片,即可. 效果: 宽:5.9高: 7.91

  7. 如何解决 Matlab 画图时中文显示乱码的问题?

    使用的是win10系统,从前几个月某一天,我的matlab的figure里的中文都变成了口口.很是郁闷,还以为是动到了什么配置引起的. 前几天更新了matlab 2018b,发现还有这个问题.就觉得不 ...

  8. matlab 画图进阶

    matlab 画图进阶 applications of matlab in engineering 图表类型的选择 first:advanced 2d plots special plots logl ...

  9. 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 ...

随机推荐

  1. npm与cnpm

    npm介绍 说明:npm(node package manager)是nodejs的包管理器,用于node插件管理(包括安装.卸载.管理依赖等) 使用npm安装插件:命令提示符执行npm instal ...

  2. app自动化配置信息

    caps={    "platformName":"Android",#平台名称    "platformVersion":"6. ...

  3. vue之组件的使用(转载)

    在工程目录/src下的component文件夹下创建一个 firstcomponent.vue并写仿照 App.vue 的格式和前面学到的知识写一个组件. <template> <d ...

  4. Linux 编译升级 FFmpeg 步骤

    如果服务器已经安装了一个 Ffmpeg 的话,比如已安装在 /usr/local/ffmpeg 目录.Linux下版本升级步骤如下: 1.下载 ffmpeg-*.tar.gz到 Ffmpeg 官网 h ...

  5. xshell通过xftp传输Windows文件到Linux:在输入put后,再摁 TAB 键,可显示当前文件夹的文件

    在输入put后,再摁 TAB 键,可显示当前文件夹的文件 sftp:/home/yan> put $Recycle.Bin\              BluestacksCN\         ...

  6. Abaqus用户子程序umat的学习

    Abaqus用户子程序umat的学习 说明:在文件中,!后面的内容为注释内容.本文为学习心得,很多注释是自己摸索得到.如有不正确的地方,敬请指正. ! ------------------------ ...

  7. 解决Spellchecker inspection helps locate typos and misspelling in your code

    idea出现这个是因为词库中没有这个单词,所以提示拼写错误 解决办法:双击下面有虚线的单词——>鼠标右键——>spelling——>save 'xxx' to distionary

  8. LeetCode(20)Valid Parentheses

    题目 Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the i ...

  9. 今年把js总结了一下,ppt格式的

    本来想梳理成html,但是时间有限. 希望能够有所帮助. http://pan.baidu.com/s/1ntGAfED http://files.cnblogs.com/danghuijian/js ...

  10. ORACLE-023:令人烦恼的 ora-01722 无效数字

    https://blog.csdn.net/yysyangyangyangshan/article/details/51762746