MATLAB 绘制折线图
MATLAB 绘制折线图
想要绘制出如上图所示折线图,首先,先展示代码:
x=0:10:50;
a=[0, 1.80,7.60,17.40,31.20,49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);
grid
b=[0,1.10,4.20,9.30,16.40,25.50];
hold on
plot(x,b,'s-y','MarkerSize',2,'MarkerFaceColor','y','MarkerEdgeColor','y','LineWidth',2);
c=[0,1.10,4.20,9.30,16.40,25.50];
hold on
plot(x,c,'+-b','MarkerSize',1.5,'MarkerFaceColor','b','MarkerEdgeColor','b','LineWidth',1.5);
d=[0,0.20,0.40,0.60,0.80,1.00]
hold on
plot(x,d,'s-k','MarkerSize',2,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',2);
e=[0,0.10,0.20,0.30,0.40,0.50]
hold on
plot(x,e,'s-r','MarkerSize',2,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',2)
xlabel('Number of participant','fontsize',22,'FontWeight','bold','FontName','Times New Roman')
ylabel('Number of transmission x10^3','fontsize',21,'FontWeight','bold','FontName','Times New Roman')
h=legend('LGHW13','HSXL16','CM17','HSL17','Ours',loc = 0)
set(h,'Fontsize',16,'FontWeight','bold','FontName','Times New Roman');
set(gca,'FontSize',20,'LineWid',2);%设置坐标轴字体打下以及网格粗细
- 设置x轴的数值:0到50 ,间隔为10
- a相当于第一个函数y值,b第二个函数y值,依次类推。
- grid 是绘制后面的格子,grid on 有格子,grid off 没有格子
- plot 是开始绘制,前两个参数是x 和y, 第三个参数是曲线的样式颜色,第四个是说曲线上的方块圆等的大小,下一个是说标志点的内填充颜色,下一个是边缘填充颜色。
- xlabel 是设置x坐标轴标题的,包括文字的内容,大小,样式等等。
- ylabel 是设置y坐标轴标题的,
- 设置legend图例 ,其中的loc表示图例的位置,这个需要自己试试。
'best' : 0, (only implemented for axes legends)(自适应方式)
'upper right' : 1,
'upper left' : 2,
'lower left' : 3,
'lower right' : 4,
'right' : 5,
'center left' : 6,
'center right' : 7,
'lower center' : 8,
'upper center' : 9,
'center' : 10,
---------------------
原文:https://blog.csdn.net/You_are_my_dream/article/details/53440964
- 图例中一行set是对图例中文字的说明。
- 最后一行是设置坐标轴上刻度字体大小,LineWid 是设置网格的粗细。
附上论文中两图代码,以供回忆
x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);grid
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,'s-y','MarkerSize',2,'MarkerFaceColor','y','MarkerEdgeColor','y','LineWidth',2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,'+-b','MarkerSize',1.5,'MarkerFaceColor','b','MarkerEdgeColor','b','LineWidth',1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00
]
hold on
plot(x,d,'s-k','MarkerSize',2,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',2);
e=[0,
0.10,
0.20,
0.30,
0.40,
0.50
]
hold onplot(x,e,'s-r','MarkerSize',2,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',2)
xlabel('Number of participant','fontsize',22,'FontWeight','bold','FontName','Times New Roman')
ylabel('Number of transmission x10^3','fontsize',21,'FontWeight','bold','FontName','Times New Roman')
h=legend('LGHW13','HSXL16','CM17','HSL17','Ours','FontSize',12,loc = 0)
set(h,'Fontsize',16,'FontWeight','bold','FontName','Times New Roman');
set(gca,'FontSize',20,'LineWid',2);%设置坐标轴字体打下以及网格粗细x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);
grid on
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,'s-y','MarkerSize',2,'MarkerFaceColor','y','MarkerEdgeColor','y','LineWidth',2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,'+-b','MarkerSize',1.5,'MarkerFaceColor','b','MarkerEdgeColor','b','LineWidth',1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00]
hold on
plot(x,d,'s-k','MarkerSize',2,'MarkerFaceColor','k','MarkerEdgeColor','k','LineWidth',2);
e=[0.5
0.055
0.105
0.155
0.205
0.255]
hold on
plot(x,e,'s-r','MarkerSize',2,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',2)
xlabel('Number of participant','fontsize',22,'FontWeight','bold','FontName','Times New Roman')
ylabel('Number of measurement x10^3','fontsize',21,'FontWeight','bold','FontName','Times New Roman')
h=legend('LGHW13','HSXL16','CM17','HSL17','Ours','FontSize',12,loc = 0)
set(h,'Fontsize',16,'FontWeight','bold','FontName','Times New Roman');
set(gca,'FontSize',20,'LineWid',2);修改后的第二个x=0:10:50;
a=[0,
1.80,
7.60,
17.40,
31.20,
49.00]
plot(x,a,'s-g','MarkerSize',2,'MarkerFaceColor','g','MarkerEdgeColor','g','LineWidth',2);
grid on
b=[0,
1.10,
4.20,
9.30,
16.40,
25.50];
hold on
plot(x,b,'s-m','MarkerSize',2,'MarkerFaceColor','m','MarkerEdgeColor','m','LineWidth',2);
c=[0,
1.10,
4.20,
9.30,
16.40,
25.50
];
hold on
plot(x,c,'+-b','MarkerSize',1.5,'MarkerFaceColor','b','MarkerEdgeColor','b','LineWidth',1.5);
d=[0,
0.20,
0.40,
0.60,
0.80,
1.00]
hold on
plot(x,d,'s-c','MarkerSize',2,'MarkerFaceColor','c','MarkerEdgeColor','c','LineWidth',2);
e=[0.5
0.055
0.105
0.155
0.205
0.255]
hold on
plot(x,e,'s-r','MarkerSize',2,'MarkerFaceColor','r','MarkerEdgeColor','r','LineWidth',2)
xlabel('Number of participant','fontsize',22,'FontWeight','bold','FontName','Times New Roman')
ylabel('Number of measurement x10^3','fontsize',21,'FontWeight','bold','FontName','Times New Roman')
h=legend('LGHW13','HSXL16','CM17','HSL17','Ours','FontSize',12,loc = 0)
set(h,'Fontsize',16,'FontWeight','bold','FontName','Times New Roman');
set(gca,'FontSize',20,'LineWid',2);
MATLAB 绘制折线图相关推荐
- matlab绘制折线图基本操作
本篇博客主要总结matlab绘制折线图的基本操作,使用的函数是plot函数,关于plot的函数语法规则,这里不再赘述,可以参考matlab官方文档,https://ww2.mathworks.cn/h ...
- MATLAB如何绘制折线图和美化折线图
MATLAB如何绘制折线图和美化折线图 MATLAB如何绘制折线图和美化折线图 绘制基本图像 GUI界面进行调整 编写代码进行调整 总结 MATLAB如何绘制折线图和美化折线图 在写论文的时候,我们直 ...
- Matlab三维折线图绘制–surf 函数的使用
Matlab三维折线图绘制–surf 函数的使用 最近在写毕业论文,整理数据需要绘制一个简单的三维图,简单做个分享! 先上结果图: 最后附上代码: clc,clear,close all; % f ...
- matlab画折现_MATLAB实例:绘制折线图
MATLAB实例:绘制折线图 用MATLAB将几组不同的数据展示在同一张图片中,并设置图例.横纵坐标范围与名称.重新自定义横坐标刻度,并保存图片到指定位置. 1. demo_1.m clear clc ...
- python matplotlib画折线图_python使用matplotlib绘制折线图教程
matplotlib简介 matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地行制图.而且也可以方便地将它作为绘图控件,嵌入GUI应用程序 ...
- python画曲线图例-python使用matplotlib绘制折线图教程
matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地行制图.而且也可以方便地将它作为绘图控件,嵌入GUI应用程序中. 它的文档相当完备,并 ...
- 如何使用python画折线图-python使用matplotlib绘制折线图教程
matplotlib简介 matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的命令API,十分适合交互式地行制图.而且也可以方便地将它作为绘图控件,嵌入GUI应用程序 ...
- python画折线图-手把手教你Python yLab的绘制折线图的画法
Python的可视化工具有很多,数不胜数,各有优劣.本文就对其中的pylab进行介绍.之所以介绍这一款,是因为它和Matlab的强烈相似度,如果你使用过Matlab,那么相信pylab你也会很快上手. ...
- matlab散点图折线图_什么是散点图以及何时使用
matlab散点图折线图 When you were learning algebra back in high school, you might not have realized that on ...
- matlab绘制星座图,怎么弄星座图:systemview 信号星座图怎么画
systemview 信号 用接收计算器 matlab中怎么绘制星座图??? 看看这个程序是否符合你的要求:按下鼠标左键开始绘制一个星座图,点击右键结束当前星座function xingzuofigu ...
最新文章
- gitlab常用命令
- Linq之select子句
- unity怎么实现人脸追踪_Unity 2019.2 beta为AR增加面部追踪、2D图像追踪、3D对象追踪等功能...
- el-table-column中格式化判断数据为空则显示指定内容
- 使用alipaySDK编译时找不到openssl/asn1.h文件的解决办法(初探)
- 原型链 —— 以隐式引用作为存储方式的单向链表
- C++ exit 与 return 浅析
- C语言库函数大全及应用实例六
- bzoj3322 最大生成树+LCA
- 转:13个大数据应用案例,告诉你最真实的大数据故事
- codeblocks下载安装及问题解决
- matlab常用开头,在MATLAB编辑中,以“”开头的表示()。
- PHP的WMB队列消费代理的实现
- 掌上单片机实验室 — 激活(4)
- 论文学习——基于滑动窗口预测的水位时间序列异常检测
- 烙铁-电子工程师的画笔
- 东北大学计算机学院领导,计算机学院召开新一届全体干部大会
- a+++a和a+a++的区别
- python 数据可视化工具 -- pyecharts
- RC吸收和单C吸收对模式VDS和后级肖特基二极管的影响?