漂亮,美观的图表之Matlab强势回归~~~~走你5

本文将学习三个图形函数——stem, staris,pie.

%% pie用于描绘平面饼图
X = [1, 2, 3, 4, 5];
 pie(X)


 

%% 画饼状图
 Expenses = [20 10 40 12 20 19 5 15];
ExpenseCategories = {'Food','Medical','Lodging','Incidentals','Transport','Utilities','Gifts','Shopping'};
MostLeastExpensive = (Expenses==max(Expenses)|Expenses==min(Expenses)); 
h=pie(gca,Expenses,MostLeastExpensive,ExpenseCategories);


 

%% stem用于画离散的数据序列
x = linspace(0,2,100);
x1 = x(1:13:end);
x2 = x(1:5:end);
y = exp(.3*x).*cos(-2*x);
yy = round(rand(1,length(x1)));yy(find(yy==0))=-1;
y1 = exp(.3*x1).*cos(-2*x1)+yy.*rand(1,length(x1));
yy = round(rand(1,length(x2)));yy(find(yy==0))=-1;
y2 = exp(.3*x2).*cos(-2*x2)+yy.*rand(1,length(x2));
plot(x,y); hold on;
h1 = stem(x1,y1);
h2 = stem(x2,y2);
% Choose marker size and style of your choice
set(h1,'MarkerFaceColor','green','Marker','o','Markersize',7,'Color',[0 0 0]);
set(h2,'MarkerFaceColor','red','Marker','square','Color',[0 0 0]);
xlabel('x');ylabel('signal');
title({'Discretizing continuous signal, by sampling at certain intervals','Measurement noise yields imperfect recordings'});


 

 

load algoResultsData.mat
h=stairs([MethodPerformanceNumbers nan(5,1)]'); 
legendMatrix = {'Fresh Tissue','FFPE','Blood','DNA','Simulated'};
for i = 1:5;
    set(h(i),'linewidth',2); % thicken the lines
    % add total # of samples in this category tolegend
    legendMatrix{i} = [legendMatrix{i} ', Total# = ' num2str(CategoryTotals(i))];
end


这篇只是简单的用了三个函数。另外还有pie3,scatter,bar, plot, plotyy这些函数,大家可以去help里面学习下。

 

另外补充下,在matlab官网看到一个函数pie3s,很漂亮的图,

 

 

pie3s([2 4 3 5],'Explode',[0 1 1 0],'Labels',{'North','South','East','West'})


pie3s 代码:

function pie3s( varargin )
%PIE3S: 3-D pie chart with added shininess
%
%   PIE3S(X) draws a 3-D pie plot of the data in the vector X.  The values
%   in X are normalized vi
  • 0
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值