word图片dpi设置:选项-高级-默认分辨率:高保真
链接:Matlab颜色对照(RGB三元组、十六进制表示)
1.代码
绘制多线型图
clc
clear
close all
x=1:100;
y1=sin(x);
y2=cos(x);
y3=sin(x)+2;
figure(1)
plot(x,y1,'b-.','markersize',5,'LineWidth',3)
%'b-.'蓝色、实线、Marker是.
%Marker的大小是5
%线宽是3
hold on
plot(x,y2,'-*','Color',[1 0 0],10,'LineWidth',2)
hold on
plot(x,y3,'-d','Color','#000000','markersize',15,'LineWidth',1)
xlabel('time/s')
ylabel('input road surface/m')
legend('sin','cos','sin+2')
%%
ZT=30;%字体30号
set(gca,'FontSize',ZT);
aaa=2;
set(gcf,'unit','centimeters','position',[2 2 16*aaa 9*aaa]);
set(gca,"FontName","Times New Roman","FontSize",ZT,"LineWidth",2);
附加说明
%% 线型
% - Solid line (default)
% -- Dashed line
% : Dotted line
% -. Dash-dot line
%% 颜色
% y yellow
% m magenta品红
% c cyan青绿
% r red
% g green
% b blue
% w white
% k black
%plot(x,y,'color',[0.5 0.5 0.5])灰色
%plot([1 10],[1 1],'-k','linewidth',2); % black 黑色
%plot([1 10],[2 2],'-b','linewidth',2); % blue 蓝色
%plot([1 10],[3 3],'-r','linewidth',2); % red 红的
%plot([1 10],[4 4],'-','color',[255 174 0]/255,'linewidth',2); % orange 橘黄色
%plot([1 10],[5 5],'-','color',[4 157 107]/255,'linewidth',2); % dark green 深绿色
%plot([1 10],[6 6],'-','color',[247 177 229]/255,'linewidth',2); % pink 粉色
%plot([1 10],[7 7],'-','color',[255 0 251]/255,'linewidth',2); % purple 紫色
%% 标记
% o Circle
% + Plus sign
% * Asterisk
% . Point
% x Cross
% s Square方块
% d Diamond菱形
% ^ Upward-pointing triangle
% v Downward-pointing triangle
% > Right-pointing triangle
% < Left-pointing triangle
% p Pentagram五角星
% h Hexagram六角星
图片属性检查器里点击 线 可调整其性质
1.1.设置坐标轴范围、间隔
clc
clear
close all
x=1:100;
y1=sin(x);
y2=cos(x);
y3=sin(x)+2;
figure(1)
plot(x,y1,'b-.','markersize',5,'LineWidth',3)
%'b-.'蓝色、实线、Marker是.
%Marker的大小是5
%线宽是3
hold on
plot(x,y2,'r-*','markersize',10,'LineWidth',2)
hold on
plot(x,y3,'k-d','markersize',15,'LineWidth',1)
xlabel('time/s')
ylabel('input road surface/m')
legend('sin','cos','sin+2')
%% 设置坐标轴范围、间隔
xlim([0,50]);%设置x轴范围
xticks(0:5:50);%设置x轴间隔
%%
ZT=30;%字体30号
set(gca,'FontSize',ZT);
aaa=2;
set(gcf,'unit','centimeters','position',[2 2 16*aaa 9*aaa]);
set(gca,"FontName","Times New Roman","FontSize",ZT,"LineWidth",2);
2.内加Latex标注复杂公式/单位
clc
clear
close all
x=1:100;
y1=sin(x);
y2=cos(x);
y3=sin(x)+2;
figure(1)
plot(x,y1,'b-.','markersize',5,'LineWidth',3)
%'b-.'蓝色、实线、Marker是.
%Marker的大小是5
%线宽是3
hold on
plot(x,y2,'r-*','markersize',10,'LineWidth',2)
hold on
plot(x,y3,'k-d','markersize',15,'LineWidth',1)
xlabel('$\ddot{z_b}{(m/s^2)}$','interpreter','latex');
ylabel('${q_1}{*10^7}$','interpreter','latex');
legend('sin','cos','sin+2')
%%
ZT=30;%字体30号
set(gca,'FontSize',ZT);
aaa=2;
set(gcf,'unit','centimeters','position',[2 2 16*aaa 9*aaa]);
set(gca,"FontName","Times New Roman","FontSize",ZT,"LineWidth",2);
其他要求:没有顶部右部刻度+限制刻度数量
有些期刊会要求
1.box图的顶部、右部没有刻度
2.限制x、y坐标轴的刻度数
代码如下所示
clc
clear
close all
x=1:100;
y1=sin(x);
y2=cos(x);
y3=sin(x)+2;
figure(1)
plot(x,y1,'b-.','markersize',5,'LineWidth',3)
%'b-.'蓝色、实线、Marker是.
%Marker的大小是5
%线宽是3
hold on
plot(x,y2,'r-*','markersize',10,'LineWidth',2)
hold on
plot(x,y3,'k-d','markersize',15,'LineWidth',1)
xlabel('time/s')
ylabel('input road surface/m')
legend('sin','cos','sin+2')
%% 坐标轴设置
box off
zbzc=1.0;%坐标轴粗
%部分期刊会要求轴与线粗细不同
ZT=30;%字体30号
set(gca,'FontSize',ZT);
aaa=2;
set(gca,'XTick',0:100/4:100);%通过调整坐标值调整坐标数量
set(gca,'YTick',-1:4/4:3);%通过调整坐标值调整坐标数量
set(gcf,'unit','centimeters','position',[2 2 16*aaa 9*aaa]);
set(gca,"FontName","Times New Roman","FontSize",ZT,"LineWidth",zbzc);
%% 补充空白的顶部、右部坐标轴
ax = axes('Position',get(gca,'Position'),'XAxisLocation','top','YAxisLocation','right','Color','none');
set(ax,'linewidth',zbzc,'XTick',[],'YTick',[]);
效果如下