javaframe很奔放,6版本没有,7版本说过时,以后不让用了,还是替换掉,让chaching老兄尽早用跑上这个代码:- function ex04
- figure('menubar','none','name','一张有趣的图片','NumberTitle','off');
- hold on
- plotEllipse([1/2,sqrt(3)/2],0.7,.4,pi/2,'r',0.5,'帅');
- plotEllipse([0,0],.7,.4,pi/6,'b',0.5,'有才');
- plotEllipse([1,0],.7,.4,pi*5/6,'y',0.5,'有钱');
- axis equal off
- drawnow
- PosS=get(0,'screensize');
- set(gcf,'position',PosS)
- gtext({'穷';'骗';'老'},'FontName','Times','Fontsize',12,...
- 'HorizontalAlignment','center','FontWeight','bold','color','w');
- function plotEllipse(position,longaxis,shortaxis,rotat,color,alph,string)
- t=linspace(0,2*pi);
- x=longaxis*cos(t);
- y=shortaxis*sin(t);
- xy=[cos(rotat) -sin(rotat);sin(rotat) cos(rotat)]*[x;y];
- xr=xy(1,:)+position(1);
- yr=xy(2,:)+position(2);
- patch(xr,yr,color,'FaceAlpha',alph);
- text(mean(xr),mean(yr),string,'fontname',...
- '黑体','fontsize',20,'HorizontalAlignment','center');
复制代码 |