2019-8-31-matlab-画图
| title | author | date | CreateTime | categories |
|---|---|---|---|---|
|
matlab 画图
|
lindexi
|
2019-08-31 16:55:59 +0800
|
2018-2-13 17:23:3 +0800
|
本文讲如何使用 matlab 画图。
本文包括:折线图的 x轴和y轴、标题、图例
柱状图填充图案
折线图
接下来讲的matlab如何设置图形的图例和x轴的距离
折线图的图例需要知道的是 Legend ,使用他可以进行设置
legend(...,'Location',LOC) adds a legend in the specified
location, LOC, with respect to the axes. LOC may be either a
1x4 position vector or one of the following strings:
'North' inside plot box near top
'South' inside bottom
'East' inside right
'West' inside left
'NorthEast' inside top right (default for 2-D plots)
'NorthWest' inside top left
'SouthEast' inside bottom right
'SouthWest' inside bottom left
'NorthOutside' outside plot box near top
'SouthOutside' outside bottom
'EastOutside' outside right
'WestOutside' outside left
'NorthEastOutside' outside top right (default for 3-D plots)
'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
如何设置x轴大小?
可以通过set(gca,'xtick',1:1:100);代码设置从1开始,结束100,解释一下
set(gca,'xtick',开始:两个点之间:结束);
直方图
如何画柱状图,如何在柱状图使用不同的图案填充?
matlab 柱状图填充图案可以使用 applyhatch 画图,下面将告诉大家如何做
第一步是复制文件applyhatch.m到自己电脑。关于applyhatch.m到哪里下,请自己百度,如果寻找不到,可以联系我lindexi_gd@163.com
才不告诉在这里下
第二步是把文件拷贝到工作台,工作台是什么,就是软件打开的文件夹路径,这个路径如下图
可以自己修改,只要把上面的文件放在这个文件夹就可以了。
使用方式是applyhatch(gcf,'\.x.');
其中第二个参数就是使用不同的图案,可以使用添加'/', '\', '|', '-', '+', 'x', '.'几个字符
例子:
close all
clear all
clc
% The computer journal paper
% Jigang Wu etc.
% copyright: lonchen@mail.ustc.edu.cn % data = [31,32,35;72,73,75;113,114,117;144,146,147;171,173,174;213,215,220];
data =[16,17,18;33,34,37;51,54,55;71,74,74;86,91,91;105,113,113];
bar(data,1);
axis([0 7 0.0 150]);
legend('DPA','TSRP','GRP',0);
grid on;
set(gca,'XTickLabel',{'100','200','300','400','500','600'}); xlabel('The number of internal nodes');
ylabel('The number of replica that created');
set(gcf,'Color','w'); % 设置背景颜色为白色,否则坐标轴出现区域的颜色为灰色
applyhatch(gcf,'\.x.');
对于不同组合的直方图,使用 data=[数据1.1,数据1.2,数据1.3;数据2.1,数据2.2……]
然后画出来,使用bar(data,1); 第二个参数是宽度,自己尝试修改第二个值跑一下。
可以使用图例,matlab的图例使用的legend('DPA','TSRP','GRP',0); 有多少个数据就添加对应图例。
试试下面代码:
y=[559006 ,2269384,783762;508559 ,2140905,696001;506491,2007763,735464]
bar(y,0.6) legend('n','N','l')
grid on;
set(gca,'XTickLabel',{'第一次','第二次','第三次'}) xlabel('匹配次数') ylabel('结果数') set (gcf,'Position',[500,500,500,500], 'color','w') applyhatch(gcf,'\.x./'); set(gcf,'Color','w');
如果过程遇到问题,可以联系我 lindexi_gd@163.com。
感谢陈龙师兄的帮助。
2019-8-31-matlab-画图的更多相关文章
- Matlab画图,坐标轴范围设置和间隔设置
在Matlab画图的时候,系统默认的坐标轴范围以及间隔有时候并不是很合适,如何根据自己的要求来显示呢,Set语句就可以帮忙咯!! 1. set(gca,'xtick',0:100:2500) ...
- Matlab画图-非常具体,非常全面
Matlab画图 强大的画图功能是Matlab的特点之中的一个,Matlab提供了一系列的画图函数,用户不须要过多的考虑画图的细节,仅仅须要给出一些基本參数就能得到所需图形,这类函数称为高层画图函数. ...
- 设置 matlab 画图格式
1:设置 matlab 画图格式 clear;clc; % load("array.mat"); % Bestallarray=array; % rllofcircle(Besta ...
- 如何解决 Matlab 画图时中文显示乱码的问题?
使用的是win10系统,从前几个月某一天,我的matlab的figure里的中文都变成了口口.很是郁闷,还以为是动到了什么配置引起的. 前几天更新了matlab 2018b,发现还有这个问题.就觉得不 ...
- matlab 画图进阶
matlab 画图进阶 applications of matlab in engineering 图表类型的选择 first:advanced 2d plots special plots logl ...
- matlab 画图技巧
基本画图工具:matlab 画图中线型及颜色设置 matlab中坐标轴设置技巧 **Matlab中的坐标轴设置技巧** axisoff; %去掉坐标轴 axistight; ...
- agentzh 的 Nginx 教程(版本 2019.07.31)
agentzh 的 Nginx 教程(版本 2019.07.31) agentzh 的 Nginx 教程(版本 2019.07.31) https://openresty.org/download/a ...
- 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 ...
- matlab画图函数plot()/set/legend
简单plot()/legend/XY轴范围axis 除了坐标轴信息外还可以添加其它的信息,如所画曲线的信息等:测试代码如下 x=0:pi/20:2*pi; y1=sin(x); y2=cos(x); ...
- MATLAB画图
画图代码 clear % http://www.peteryu.ca/tutorials/matlab/visualize_decision_boundaries % load RankData % ...
随机推荐
- Python之计算当前月份的日期范围(calendar、datetime)
在当前月份中循环每一天大致的思路就是先计算出当月的第一天和下个月的第一天日期,还有当月总共有多少天,然后把第一天日期按照月总天数累加到下个月的第一天,就ok 啦 from datetime impor ...
- IDEA compile successfully many errors still occur
Compile and install successfully with maven in IDEA, but error prompt still popup. Your local enviro ...
- echarts学习思路及常用属性记录
此篇博文分享自己对于入门学习echart的思路及对常见组件的用法记录,如serise.data和坐标轴对应关系,多个坐标轴,多个grid的对齐,tooltip的超出处理,坐标轴/toolti ...
- for循环(C语言型)语法
- RAD介绍及实战,LVM介绍及实战,磁盘常见故障
目录 一.RAID 1.RAID好处: 2.RAID的运行方式: 3.RAID的级别: 二.RAID实战 软RAID 1.RAID0 2.RAID1 3.RAID5 4.RAID10 三.LVM介绍 ...
- oldlinux
http://oldlinux.org/Linux.old/ http://oldlinux.org/Book-Lite/
- git-window-install及常用命令
step 1 : msysgit安装 step 2 : 安装完毕后,打开git bash 输入以下命令: git config --global user.name xxx (用户名) git con ...
- SpringMvc支持Ajax概述【见前两篇随笔--详述前后数据互通】
1.原生javaWeb:不再用 1).导入GSON: 2).返回的数据用GSON转成json 3).写出去: 2.SpringMVC快速的完成ajax功能? 导包 jackson-annotation ...
- visual Studio如何使用断点调试程序?
1.在想要添加断点的地方右侧点击,点击成功后会出现红色原点. 2.启动程序,当进行到断点处时,程序会停止,然后可以看到一个黄色的小箭头在断点处 3.快捷键F10:进行下一句代码 4.快捷键F11:进入 ...
- 前端导出excel表格
前言近期项目有个新需求--将折线图表的数据加一个下载成excel表格的功能.以前下载功能都是调后台接口的,但是这个迭代,后台压力比较重,部分就交给了前端自己实现,下面就记录一下前端如何实现excel表 ...