1、常用全局设置
set(gca,'FontName','Times New Roman', 'FontSize', 10);
set(gca,'xcolor',[1 0 0]);
set(gca,'ycolor',[1 0 0]);
2、设置横/纵坐标刻度标签
set(gca,'XTickLabel',["LR", "SVR", "KNN", "Tree", "ElasticNet", "BR"])
set(gca,'YTickLabel',["LR", "SVR", "KNN", "Tree", "ElasticNet", "BR"])
3、设置横/纵坐标刻度
set(gca,'xtick',0:10:40) % xticks(0:10:40)
set(gca,'ytick',0:10:40) % yticks(0:10:40)
4、设置刻度长度(设置为0表示隐藏刻度线)
set(gca,'ticklength',[0 0])
5、横纵坐标标签设置字体,字体大小,字体颜色
xlabel('Time (min)', "FontName","Times New Roman", 'FontSize', 13, 'color', [0 0.4470 0.7410])
ylabel('Time (min)', "FontName","Times New Roman", 'FontSize', 13, 'color', [0 0.4470 0.7410])
5、一些色调
浅红色 [1,0.58,0.8]
浅蓝色 [0.58,0.8,1]
草莓色 [0.53,0.15,0.34]
浅绿色 [0.8,1,0.58]
浅橙色 [1,0.8,0.58]
浅紫色 [0.8,0.58,1]
原文:https://zhuanlan.zhihu.com/p/430861421
7、柱状图常用设置
y = [75 91 105 123.5 131 150 179 203 226 249 281.5];
bar(y,'FaceColor',[0 .5 .5],'EdgeColor',[0 .9 .9],'LineWidth',1.5)
含多组bar时
set(h(1),'FaceColor', color1, 'EdgeColor', color2, 'BarWidth', 0.8);
8、colorbar常用设置
c = colorbar;
c.Label.String = 'Cycle Life';
c.Label.FontSize = 13;
caxis([1 100]);
set(c,'ytick',[1, 50, 100])
9、导出图片
export_fig(gcf , '-png' , '-r300' , '-transparent', '-painters' , 'img.png');