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 ...
随机推荐
- 嵌入式C语言-学习书籍推荐(pdf附上百度云链接)
先推荐学习视频网站: https://www.bilibili.com/video/av22631677?from=search&seid=800092160484173881 书籍只推荐2本 ...
- Django的架构
简介 Django继承并简化了MVC架构.MVC中的Controller部分基本全由Django完成.View部分被分割成两部分,即:负责HTML渲染的模板和负责显示逻辑的视图.所以Django又被称 ...
- uva11491 Erasing and Winning
边读入边处理 优化了速度一开始有想错了的地方.处理输入有点想用stringstream, 的问题在于他把字符串连续的数字作为一个整体,遇到空格才分开,所以不适用 #include<cstdio& ...
- socks5代理原理解析
sock5代理的工作程序是: 1.需要代理方向服务器发出请求信息. 2.代理方应答 3.需要代理方接到应答后发送向代理方发送目的ip和端口 4.代理方与 ...
- Visual Odometry
http://www.cvlibs.net/datasets/kitti/eval_odometry.php
- pm2 start命令中的json格式详解
pm2 start npm -- start这条命令是pm2的万能命令,pm2 start <json>,就是这一系列命令中的最豪华命令.这个json我们可以理解为一个任务参数描述文件.通 ...
- [CF] 950A Left-handers, Right-handers and Ambidexters
A. Left-handers, Right-handers and Ambidexters time limit per test1 second memory limit per test256 ...
- QEMU支持的几种常见的镜像文件格式
qemu-img支持非常多种的文件格式,可以通过"qemu-img -h"查看其命令帮助得到,它支持二十多种格式:blkdebug.blkverify.bochs.cloop.c ...
- 2019年,Python工程师必考的6个面试题,Python面试题No5
第1题:Python里面如何实现tuple和list的转换? 函数tuple(seq)可以把所有可迭代的(iterable)序列转换成一个tuple, 元素不变,排序也不变 list转为tuple: ...
- 【HDU 5934】Bomb(强连通缩点)
Problem Description There are N bombs needing exploding. Each bomb has three attributes: exploding r ...