Changeset 15056
- Timestamp:
- 05/21/13 10:41:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/applyoptions.m
r15043 r15056 440 440 %get current plot position 441 441 cplotpos=get(gca,'pos'); 442 %compute inset position 443 PosInset=[cplotpos(1)+insetpos(1)*cplotpos(3),cplotpos(2)+insetpos(2)*cplotpos(4), insetpos(3)*cplotpos(3), insetpos(4)*cplotpos(4)]; 444 %show pos 442 445 443 X1=getfieldvalue(options,'insetx',xlim); 446 444 Y1=getfieldvalue(options,'insety',ylim); 447 if strcmpi(getfieldvalue(options,'showinset','off'),'on') 448 line(X1([1 2 2 1 1]),Y1([1 1 2 2 1]),zeros(1,5),'Color','k','LineWidth',2); 449 end 450 451 %Get current figure 452 ax1=gca; 453 454 %plot inset 455 axes('pos',PosInset); 456 copyobj(get(ax1,'children'),gca); 457 patch('Faces',[1 2 3 4 1],'Vertices',[X1([1 2 2 1])' Y1([1 1 2 2])'],'FaceColor','None','EdgeColor','k','LineWidth',2); 458 459 %applay options 460 options=removefield(options,'text',0); 461 options=removefield(options,'title',0); 462 options=removefield(options,'xlabel',0); 463 options=removefield(options,'ylabel',0); 464 options=removefield(options,'inset',0); 465 options=removefield(options,'offsetaxispos',0); 466 options=removefield(options,'showregion',0); 467 options=changefieldvalue(options,'colorbar',0); 468 options=changefieldvalue(options,'latlon','off'); 469 options=changefieldvalue(options,'axis','equal off'); 470 options=changefieldvalue(options,'xlim',getfieldvalue(options,'insetx',xlim)); 471 options=changefieldvalue(options,'ylim',getfieldvalue(options,'insety',ylim)); 472 applyoptions(md,data,options); 473 474 %back to main gca 475 set(gcf,'CurrentAxes',maingca) 476 end 445 446 for i=1:length(getfieldvalue(options,'insetx')), 447 if length(insetpos)==4, 448 insetposi=insetpos; 449 else 450 insetposi=insetpos{i}; 451 end 452 PosInseti=[cplotpos(1)+insetposi(1)*cplotpos(3),cplotpos(2)+insetposi(2)*cplotpos(4), insetposi(3)*cplotpos(3), insetposi(4)*cplotpos(4)]; 453 %show pos 454 if length(X1==2), 455 X1i=X1; 456 else 457 X1i=X1{i}; 458 end 459 if length(Y1==2), 460 Y1i=Y1; 461 else 462 Y1i=Y1{i}; 463 end 464 if strcmpi(getfieldvalue(options,'showinset','off'),'on') 465 line(X1i([1 2 2 1 1]),Y1i([1 1 2 2 1]),zeros(1,5),'Color','k','LineWidth',2); 466 end 467 468 %Get current figure 469 ax1=gca; 470 471 %plot inset 472 axes('pos',PosInseti); 473 copyobj(get(ax1,'children'),gca); 474 patch('Faces',[1 2 3 4 1],'Vertices',[X1i([1 2 2 1])' Y1i([1 1 2 2])'],'FaceColor','None','EdgeColor','k','LineWidth',2); 475 476 %apply options 477 options=removefield(options,'text',0); 478 options=removefield(options,'title',0); 479 options=removefield(options,'xlabel',0); 480 options=removefield(options,'ylabel',0); 481 options=removefield(options,'inset',0); 482 options=removefield(options,'offsetaxispos',0); 483 options=removefield(options,'showregion',0); 484 options=changefieldvalue(options,'colorbar',0); 485 options=changefieldvalue(options,'latlon','off'); 486 options=changefieldvalue(options,'axis','equal off'); 487 options=changefieldvalue(options,'xlim',X1i); 488 options=changefieldvalue(options,'ylim',Y1i); 489 applyoptions(md,data,options); 490 491 %back to main gca 492 set(gcf,'CurrentAxes',maingca) 493 end 494 end
Note:
See TracChangeset
for help on using the changeset viewer.