MATLAB 论文绘图规范标注

在MATLAB中进行绘图时,标注(annotation)是一个重要的功能,它可以用来添加文本、箭头、图形等对象来说明图形中的特定部分。论文出图需要规范,需要有对应的标题、图例、坐标轴信息等。

matlab 复制代码
clear
clc
close all
x = 0:0.1:10;
y1 = sin(x);
y2 = cox(x);

1.标题和标签

  • 使用 title 函数添加图表标题。
  • 使用 xlabel 和 ylabel 函数添加 x 轴和 y 轴的标签。
  • 使用 legend 函数添加图例,解释不同线条或数据系列的含义。
matlab 复制代码
title('Your Title');
xlabel('X Axis Label');
ylabel('Y Axis Label');
legend('Label 1', 'Label 2'); 

2.文本标注

  • 使用 text 函数添加文本标注。
  • 使用 annotation 函数添加更复杂的标注,如箭头、椭圆等。
matlab 复制代码
text(1, 0.5, 'Your Text', 'FontSize', 12);
annotation('arrow', [0.3, 0.1], [0.7, 0.8]);

3.数据标注

使用 text 函数或 annotation 函数将文本标注添加到图表中的特定数据点

matlab 复制代码
text(3, 0.5, 'Data Label', 'FontSize', 10);

4.图形标注

  • 使用 rectangle、line、arrow 等函数创建简单的几何图形。
  • 使用 annotation 函数添加更复杂的图形标注,如箭头、椭圆等。
matlab 复制代码
rectangle('Position', [1, 2, 1, 1], 'EdgeColor', 'r', 'LineWidth', 2);
annotation('arrow', [0.3, 0.1], [0.7, 0.8]);

5.标注样式

调整字体大小、颜色、样式以及标注框的线宽和颜色,以确保标注清晰可读

matlab 复制代码
text(1, 0.5, 'Your Text', 'FontSize', 12, 'Color', 'blue');
annotation('textbox', [0.3, 0.1, 0.5, 0.5], 'String', 'Your Text', 'EdgeColor', 'black');

6.位置和布局

根据需要将标注放置在图表中合适的位置,以便清晰展示数据和信息

matlab 复制代码
% 设置标注文本的位置
x = 0.5;
y = 0.5;
% 添加标注文本
text(x, y, 'Your Text', 'FontSize', 12);

7.注释格式

使用标准的文本格式,如斜体、粗体、下标、上标等,以使标注更具可读性和美观性。

matlab 复制代码
text(x, y, '\bf{Bold Text} \it{Italic Text} \fontsize{12} Text', 'FontSize', 12);

8.以Latex解译方式的数学变量和公式的图形标注

对需要展示的变量或公式,用键盘美元符$符号包含,即$f(x)=sin and cos$,然后在图题(title)、坐标轴标注(XLabel\YLabel)、刻度(XTike/YTike)等代码行中添加

matlab 复制代码
title('$f(x)=sin and cos$','Interpreter','Latex')

9.坐标轴修饰

matlab 复制代码
ax = gca; hold on; box on
ax.XGrid = 'on';
ax.YGrid = 'on';
ax.XMinorTick = 'on';
ax.YMinorTick = 'on';
ax.LineWidth = 1.2;
ax.GridLineStyle = ':';
ax.FontName = 'Cambria';
ax.FontSize = 12;
ax.GridAlpha = .5;

10.移除右上部刻度

matlab 复制代码
box off
ax = axes('Position',get(gca,'Position'),...
'Color','none',...
'XAxisLocation','top',...
'YAxisLocation','right',...
'XColor','k',...
'YColor','k');
set(ax,'YTick', []);
set(ax,'XTick', []);
相关推荐
四维碎片4 分钟前
【Qt】线程池与全局信号实现异步协作
开发语言·qt·ui·visual studio
IT码农-爱吃辣条12 分钟前
Three.js 初级教程大全
开发语言·javascript·three.js
☺����42 分钟前
实现自己的AI视频监控系统-第一章-视频拉流与解码2
开发语言·人工智能·python·音视频
染翰1 小时前
lua入门以及在Redis中的应用
开发语言·redis·lua
王者鳜錸1 小时前
PYTHON让繁琐的工作自动化-函数
开发语言·python·自动化
兔老大RabbitMQ2 小时前
git pull origin master失败
java·开发语言·git
tt5555555555552 小时前
C/C++嵌入式笔试核心考点精解
c语言·开发语言·c++
xiao助阵2 小时前
python实现梅尔频率倒谱系数(MFCC) 除了傅里叶变换和离散余弦变换
开发语言·python
科大饭桶2 小时前
C++入门自学Day14-- Stack和Queue的自实现(适配器)
c语言·开发语言·数据结构·c++·容器
扛麻袋的少年3 小时前
7.Kotlin的日期类
开发语言·微信·kotlin