%% Made by Lwcah in 2023-03-31(公众号:Lwcah)
%% 公众号:Lwcah
%% 知乎、B站、小红书、抖音同名账号:Lwcah,感谢关注~
%% 更多MATLAB+SCI绘图教程敬请观看~
%% 绘制模板
close all;clear all;clc;
%% 1行1列
%% 一幅图的时候figureWidth = 8.5;figureHeight = 8;调整这两个参数就可以
%定义整幅图出现的在电脑屏幕上的位置以及长和宽
%这里有必要解释一下为什么figureWidth要设置为8.5;
%因详细解释需要很长的篇幅,请转公众号观看该天的文章。
figureHandle = figure;
figureUnits = 'centimeters';
figureWidth = 8.5;
figureHeight = 6;
set(gcf, 'Units', figureUnits, 'Position', [28 20 figureWidth figureHeight]);
% 注:28代表出图时图的左下角相对于整个电脑屏幕的左下角向左偏移28个单位,向上偏移20个单位。
% 可自行调节两个数字让图出在自己屏幕的某个位置
%% 定义字体和字号大小
%% 通常的SCI一般Arial字体和10字号通用
fontnamed='Arial';%字号名字
ssize=10;%字号大小
%% 如果是中文论文可以相应的更改字号名字如下
% '华文中宋' '华文仿宋' '华文宋体' '华文新魏' '华文楷体'
% '华文琥珀' '华文细黑' '华文行楷' '华文隶书' '宋体'
% '方正姚体' '微软雅黑' '方正舒体' '新宋体'
% '幼圆' '楷体' '等线' '隶书' '黑体'
%% 数据准备
% X定义第几行的数据,Y定义的数据要按升序排列
X = [1 1 1 1 1 1
2 2 2 2 2 2
3 3 3 3 3 3
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6]';
Y = [0.1 0.2 0.3 0.4 0.5 0.6
0.1 0.2 0.3 0.4 0.5 0.6
0.1 0.2 0.3 0.4 0.5 0.6
0.1 0.2 0.3 0.4 0.5 0.6
0.1 0.2 0.3 0.4 0.5 0.6
0.1 0.2 0.3 0.4 0.5 0.6]';
Z = [100 200 100 100 100 100
100 200 100 100 100 100
100 100 200 100 100 100
100 100 100 200 100 100
100 100 100 100 200 100
100 100 100 100 200 100]';
%% 绘图
plot3(X,Y,Z,'linewidth',1);
hTitle = title('Three-dimensional line chart');
hXLabel = xlabel('X');
hYLabel = ylabel('Y');
hZLabel = zlabel('Z');
%% 画图的标准格式代码
% text(0.5,0.9,'(a) XXX','fontsize',ssize,'FontName',fontnamed);%,'horiz','center'
xlabel('X-axis','fontsize',ssize,'FontName',fontnamed);
ylabel('Y-axis','fontsize',ssize,'FontName',fontnamed);
zlabel('Z-axis','fontsize',ssize,'FontName',fontnamed);
axis([0 7 0 0.7 50 250]);%XYZ轴的范围
xticks([1 2 3 4 5 6]);%画格网的时候的小刻度
xticklabels({'1','2','3','4','5','6'});%加x轴刻度标注
yticks([0.1 0.2 0.3 0.4 0.5 0.6]);%画格网的时候的小刻度
yticklabels({'0.1','0.2','0.3','0.4','0.5','0.6'});%加y轴刻度标注
zticks([50 100 150 200 250]);%画格网的时候的小刻度
zticklabels({'50','100','150','200','250'});%加z轴刻度标注
set(gca,'linewidth',1,'fontsize',ssize,'FontName',fontnamed);
% set(gca,'zticklabel',[]);%z轴不显示
% set(gca,'yticklabel',[]);%y轴不显示
% set(gca,'xticklabel',[]);%x轴不显示
grid on;box on;hold on;
%% 画legend
%方法一
kk=legend('L1','L2','L3','L4','L5','L6');
set(kk,'location','NorthEast','Box', 'off','fontsize',ssize,'FontName',fontnamed);%'orientation','horizontal',
%方法二
% columnlegend(2,{'L1','L2','L3','L4','L5','L6'},'North');%表示一行放三个图例以及图例的位置
%% Matlab中有许多位置可以选择:
% '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
%% 背景颜色
set(gcf,'Color',[1 1 1])
%% 设置完毕后,按照所需分辨率、格式输出
figW = figureWidth;
figH = figureHeight;
set(figureHandle,'PaperUnits',figureUnits);
set(figureHandle,'PaperPosition',[0 0 figW figH]);
fileout = '三维折线图';
print(figureHandle,[fileout,'.png'],'-r600','-dpng');
MATLAB - SCI 绘图配色第六期 - 三维折线图
52 浏览量
2023-05-10
16:26:01
上传
评论
收藏 194KB ZIP 举报
Lwcah(全网各平台账号同名)
- 粉丝: 980
- 资源: 11
最新资源
- 聊天系统(java+applet).zip
- 毕业设计:基于SSM的mysql-高校学生请假管理系统(源码 + 数据库 + 说明文档)
- 博客系统(struts+hibernate+spring).rar
- c语言学生成绩管理系统源码.zip
- 毕业设计:基于SSM的mysql-网约车用户服务平台(源码 + 数据库 + 说明文档)
- 内容管理系统(hibernate3+struts2+spring2)130224.rar
- 基于Java的班级管理系统课程设计源码
- 内容管理系统(hibernate3+struts2+spring2).rar
- 路由器刷breed Web控制台助手v5.8版本.rar
- Java 在 JEP 12 提供的特性预览
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈