首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >plot绘图填充(2)

plot绘图填充(2)

作者头像
万木逢春
发布于 2019-04-30 18:17:14
发布于 2019-04-30 18:17:14
8690
举报
文章被收录于专栏:帮你学MatLab帮你学MatLab
代码语言:javascript
复制
%% 简单曲线
x = -2*pi:pi/100:2*pi;
fx = sin(x);
figure('Color','w');
%设置figure颜色为白(去掉四周灰色部分)
subplot(1,2,1);
hold on
plot(x,fx);
plot(2*x+pi/2,0.5*fx+0.1*x);
hold off
title('plot');
subplot(1,2,2);
hold on
plot_shaded(x,fx);
plot_shaded(2*x+pi/2,0.5*fx+0.1*x);
hold off
title('plot\_shaded');

代码语言:javascript
复制
%% 直方图
X1 = 3 + 2.0*randn([100000,1]);
X2 = 12 + 4.0*randn([100000,1]);
figure('Color','w');
hold on
plot_histogram_shaded(X1,'Alpha',0.3);
%参数Alpha为透明度
plot_histogram_shaded(X2);
hold off
title('plot\_histogram\_shaded');

代码语言:javascript
复制
%% 分布图
X = 1:0.25:10;
Y = sin(X)+0.25*X;
Y_error = randn(1000,numel(Y));
Y_noisy = Y+Y_error.*repmat(0.1*X,[size(Y_error,1) 1]);
figure('Color','w');
subplot(3,1,1);
plot(X,Y,'LineWidth',1.5);
title('plot (True value y=f(x))');
ylim([-1 5]);
subplot(3,1,2);
hold on
plot(X,Y,'LineWidth',1.5);
plot_distribution(X,Y_noisy);
hold off
title('plot\_distribution');
ylim([-1 5]);
subplot(3,1,3);
hold on
plot(X,Y,'LineWidth',1.5);
%参数LineWidth为线宽
plot_distribution_prctile(X,Y_noisy,'Prctile',[25 50 75 90]);
%参数Prctile为要绘制的百分位值
hold off
title('plot\_distribution\_prctile');
ylim([-1 5]);       

本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2019-01-08,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档