Changeset 2827
- Timestamp:
- 01/14/10 08:05:57 (15 years ago)
- Location:
- issm/trunk/src/m/classes/public
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/plot/applyoptions.m
r2819 r2827 55 55 56 56 %axis 57 set(gca,'FontSize',fontsize); 57 58 if exist(options,'axis') 58 59 eval(['axis ' getfieldvalue(options,'axis')]); -
issm/trunk/src/m/classes/public/plot/checkplotoptions.m
r2511 r2827 73 73 74 74 %text 75 %1: textsize 76 textsizevaluesarray=cell(0,0); 77 if exist(options,'textsize'), 78 textsizevalues=getfieldvalue(options,'textsize'); 79 %ischar if only one textsize -> create a cell 80 if ischar(textsizevalues), 81 textsizevalues={textsizevalues}; 82 end 83 else 84 textsizevalues={14}; 75 %1: textvalue 76 if exist(options,'text'), 77 textvalues=getfieldvalue(options,'text'); 78 %ischar if only one expstyle -> create a cell 79 if ischar(textvalues), 80 textvalues={textvalues}; 81 numtext=1; 82 elseif iscell(textvalues), 83 numtext=length(textvalues); 84 else 85 error('plot error message: ''text'' option should be either a string or a cell'); 86 end 85 87 end 86 88 %2: textweight 87 textweightvaluesarray=cell(0,0);88 89 if exist(options,'textweight'), 89 90 textweightvalues=getfieldvalue(options,'textweight'); … … 91 92 if ischar(textweightvalues), 92 93 textweightvalues={textweightvalues}; 94 elseif ~iscell(textweightvalues); 95 error('plot error message: ''textweight'' option should be either a string or a cell'); 93 96 end 94 97 else 95 98 textweightvalues={'n'}; 96 99 end 97 %3: textcolor 98 textcolorvaluesarray=cell(0,0); 100 textweightvalues=repmat(textweightvalues,1,numtext); textweightvalues(numtext+1:end)=[]; 101 %3: textsize 102 if exist(options,'textsize'), 103 textsizevalues=getfieldvalue(options,'textsize'); 104 %ischar if only one textsize -> create a cell 105 if isnumeric(textsizevalues), 106 textsizevalues={textsizevalues}; 107 elseif ~iscell(textsizevalues); 108 error('plot error message: ''textsize'' option should be either a number or a cell'); 109 end 110 else 111 textsizevalues={14}; 112 end 113 textsizevalues=repmat(textsizevalues,1,numtext); textsizevalues(numtext+1:end)=[]; 114 %4: textcolor 99 115 if exist(options,'textcolor'), 100 116 textcolorvalues=getfieldvalue(options,'textcolor'); … … 102 118 if ischar(textcolorvalues), 103 119 textcolorvalues={textcolorvalues}; 120 elseif ~iscell(textcolorvalues); 121 error('plot error message: ''textcolor'' option should be either a string or a cell'); 104 122 end 105 123 else 106 124 textcolorvalues={'k'}; 107 125 end 126 textcolorvalues=repmat(textcolorvalues,1,numtext); textcolorvalues(numtext+1:end)=[]; 108 127 %4: textposition 109 textpositionvaluesarray=cell(0,0);110 128 if exist(options,'textposition'), 111 129 textpositionvalues=getfieldvalue(options,'textposition'); 112 %is numericif only one textposition -> create a cell130 %ischar if only one textposition -> create a cell 113 131 if isnumeric(textpositionvalues), 114 132 textpositionvalues={textpositionvalues}; 115 end 116 end 117 %5: textvalue 118 textvaluesarray=cell(0,0); 119 if exist(options,'text'), 120 textvalues=getfieldvalue(options,'text'); 121 %ischar if only one expstyle -> create a cell 122 if ischar(textvalues), 123 textvalues={textvalues}; 124 end 125 %get options 126 for i=1:length(textvalues) 127 textvaluesarray{end+1}=textvalues{i}; 128 %size 129 if (length(textsizevalues)>=i), 130 textsizevaluesarray{end+1}=textsizevalues{i}; 131 else 132 textsizevaluesarray{end+1}=textsizevalues{1}; 133 end 134 %weight 135 if (length(textweightvalues)>=i), 136 textweightvaluesarray{end+1}=textweightvalues{i}; 137 else 138 textweightvaluesarray{end+1}=textweightvalues{1}; 139 end 140 %color 141 if (length(textcolorvalues)>=i), 142 textcolorvaluesarray{end+1}=textcolorvalues{i}; 143 else 144 textcolorvaluesarray{end+1}=textcolorvalues{1}; 145 end 146 %position 147 if (length(textpositionvalues)>=i), 148 textpositionvaluesarray{end+1}=textpositionvalues{i}; 149 else 150 error('plotmodel error message: one or more textposition is missing'); 151 end 152 end 153 end 154 options=changefieldvalue(options,'text',textvaluesarray); 155 options=changefieldvalue(options,'textsize',textsizevaluesarray); 156 options=changefieldvalue(options,'textweight',textweightvaluesarray); 157 options=changefieldvalue(options,'textcolor',textcolorvaluesarray); 158 options=changefieldvalue(options,'textposition',textpositionvaluesarray); 133 elseif ~iscell(textpositionvalues); 134 error('plot error message: ''textposition'' option should be either a string or a cell'); 135 end 136 else 137 error('plot error message: ''textposition'' option is missing'); 138 end 139 options=changefieldvalue(options,'text',textvalues); 140 options=changefieldvalue(options,'textsize',textsizevalues); 141 options=changefieldvalue(options,'textweight',textweightvalues); 142 options=changefieldvalue(options,'textcolor',textcolorvalues); 143 options=changefieldvalue(options,'textposition',textpositionvalues); 159 144 160 145 %expdisp -
issm/trunk/src/m/classes/public/plot/plot_manager.m
r2819 r2827 133 133 end 134 134 applyoptions(md,data2,options); 135 136 %plot inset if requested 137 if exist(options,'inset'), 138 139 %get inset relative position (x,y,width,height) 140 insetpos=getfieldvalue(options,'insetpos',[0.56 0.55 0.35 0.35]); 141 %get current plos position 142 cplotpos=get(gca,'pos'); 143 %compute inset position 144 PosInset=[cplotpos(1)+insetpos(1)*cplotpos(3),cplotpos(2)+insetpos(2)*cplotpos(4), insetpos(3)*cplotpos(3), insetpos(4)*cplotpos(4)]; 145 146 %plot inset 147 axes('pos',PosInset); 148 box('on') 149 plot_unit(x,y,z,elements,data2,isongrid,is2d,isquiver,options); 150 151 %applay options 152 options=changefieldvalue(options,'colorbar',0); 153 options=changefieldvalue(options,'axis','equal off'); 154 options=changefieldvalue(options,'xlim',getfieldvalue(options,'insetx',[min(x) max(x)])); 155 options=changefieldvalue(options,'ylim',getfieldvalue(options,'insety',[min(y) max(y)])); 156 applyoptions(md,data2,options); 157 end -
issm/trunk/src/m/classes/public/plot/plotdoc.m
r2784 r2827 51 51 if ~strcmp(answer,'y'), return, end 52 52 53 disp(' ''alloptions'': apply the options to all subplots if ''on'''); 53 54 disp(' ''axis'': same as standard matlab option (''equal'',''off'',''equal on'',...)'); 54 55 disp(' ''basin'': zoom on a given basin (''pineislandglacier'',''ronneiceshelf'', type basinzoom for a complete list)'); … … 66 67 disp(' ''contourcolor'': ticks and contour color'); 67 68 disp(' ''density'': density of quivers (one arrow every N nodes, N integer)'); 69 disp(' ''inset'': add an inset (zoom) of the current figure if 1 (''insetx'', ''insety'' and ''insetpos'' to be documented)'); 68 70 disp(' ''streamlines'': N (number of stream lines) or {[x1 y1],...} (coordinates of seed points) add streanlines on current figure'); 69 71 disp(' ''edgecolor'': same as standard matlab option EdgeColor (color name: ''black'' or RGB array: [0.5 0.2 0.8])'); -
issm/trunk/src/m/classes/public/printmodel.m
r2822 r2827 18 18 % 19 19 % Usage: 20 % printmodel(filename,format,varargin); 21 % 22 % Examples: 20 23 % printmodel('image','tiff') 24 % printmodel('image','eps','margin','on','frame','on','hardcopy','on') 21 25 22 26 … … 33 37 options=addfielddefault(options,'framesize',5); 34 38 options=addfielddefault(options,'framecolor','black'); 35 options=addfielddefault(options,'trim','o ff');39 options=addfielddefault(options,'trim','on'); 36 40 options=addfielddefault(options,'hardcopy','on'); 37 41 … … 55 59 56 60 %some trimming involved? 57 if strcmpi(getfieldvalue(options,'trim'),'on'), 58 eval(['!convert -trim ' filename '.tif ' filename '.tif']); 61 if ~strcmpi(format,'pdf'), 62 if strcmpi(getfieldvalue(options,'trim'),'on'), 63 system(['convert -trim ' filename '.tif ' filename '.tif']); 64 end 59 65 end 60 66 61 67 %margin? 62 if strcmpi(getfieldvalue(options,'margin'),'on'), 63 marginsize=getfieldvalue(options,'marginsize'); 64 eval(['!convert -border ' num2str(marginsize) 'x' num2str(marginsize) ' -bordercolor "white" ' filename '.tif ' filename '.tif']); 68 if ~strcmpi(format,'pdf'), 69 if strcmpi(getfieldvalue(options,'margin'),'on'), 70 marginsize=getfieldvalue(options,'marginsize'); 71 system(['convert -border ' num2str(marginsize) 'x' num2str(marginsize) ' -bordercolor "white" ' filename '.tif ' filename '.tif']); 72 end 65 73 end 66 74 … … 70 78 framesize=getfieldvalue(options,'framesize'); 71 79 framecolor=getfieldvalue(options,'framecolor'); 72 eval(['!convert -border ' num2str(framesize) 'x' num2str(framesize) ' -bordercolor "' framecolor '" ' filename '.tif ' filename '.tif']);80 system(['convert -border ' num2str(framesize) 'x' num2str(framesize) ' -bordercolor "' framecolor '" ' filename '.tif ' filename '.tif']); 73 81 end 74 82 end 75 83 76 84 %convert image to correct format 77 eval(['!convert ' filename '.tif ' filename '.' format]); 78 79 %erase .tif image: 80 delete([filename '.tif']); 85 if ~strcmpi(format,'tiff') & ~strcmpi(format,'tif'), 86 system(['convert ' filename '.tif ' filename '.' format]); 87 delete([ filename '.tif']); 88 end
Note:
See TracChangeset
for help on using the changeset viewer.