1 Star 9 Fork 2

iam002 / MatlabDrawNiceGraph

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
demo02.m 715 Bytes
一键复制 编辑 原始数据 按行查看 历史
iam002 提交于 2022-03-13 00:06 . ‘整理代码’
clear
%% 设置fig背景为深色模式
back_color = [0.15, 0.15, 0.15];
h_f = figure('Color', back_color);
%% 绘制 sin
sin_axis = subplot(211);
x = linspace(-3*pi, 3*pi, 200);
y = sin(x);
plot(sin_axis, x, y, 'g-');
xlim([-3*pi, 3*pi]);
ylim([-1.2, 1.2]);
% 绘制坐标轴
mdng.DrawAxisWithArrow(sin_axis, 'XLabel', '$x$', 'YLabel', '$\sin x$', 'OLabel', '$O$');
%% 绘制 cos
cos_axis = subplot(212);
y2 = cos(x);
plot(cos_axis, x, y2, 'y-');
xlim([-3*pi, 3*pi]);
ylim([-1.2, 1.2]);
mdng.DrawAxisWithArrow(cos_axis, 'XLabel', '$x$', 'YLabel', '$\cos x$', 'OLabel', '$O$');
%% 保存为图像
if false
img_name = SaveFig2Img(h_f, 'figures\demo02.png');
fprintf('图像保存为: %s\n', img_name);
end
Matlab
1
https://gitee.com/iam002/MatlabDrawNiceGraph.git
git@gitee.com:iam002/MatlabDrawNiceGraph.git
iam002
MatlabDrawNiceGraph
MatlabDrawNiceGraph
main

搜索帮助