Changeset 1878
- Timestamp:
- 08/25/09 12:02:53 (16 years ago)
- Location:
- issm/trunk/src/m/classes/public/plot
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/public/plot/parse_options.m
r1744 r1878 31 31 else 32 32 options_struct.scaling=NaN; 33 end 34 35 %autoscale 36 autoscalevalues=findarg(optionstring,'autoscale'); 37 if ~isempty(autoscalevalues), 38 options_struct.autoscale=autoscalevalues(1).value; 39 else 40 options_struct.autoscale=NaN; 33 41 end 34 42 -
issm/trunk/src/m/classes/public/plot/plot_quiver.m
r1780 r1878 10 10 % plot_quiver(md.x,md.y,md.vx,md.vy,options_structure); 11 11 12 %keep only non NaN elements 13 pos=find(~isnan(x) & ~isnan(y) & ~isnan(u) & ~isnan(v)); 14 x=x(pos); y=y(pos); 15 u=u(pos); v=v(pos); 16 12 17 %get norm Min and Max 13 18 Norm=sqrt(u.^2+v.^2); … … 17 22 %process options: scaling factor? 18 23 if isnan(options_structure.scaling), 19 arrow=0.40;24 scalingfactor=0.40; 20 25 elseif isnumeric(options_structure.scaling), 21 arrow=options_structure.scaling; 22 elseif ischar(options_structure.scaling) & strcmpi(options_structure.scaling,'off'), 23 arrow=NaN; 26 scalingfactor=options_structure.scaling; 24 27 else 25 28 error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet') … … 58 61 59 62 %Scale data 60 if ~isnan( arrow),63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'), 61 64 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 62 u=arrow*sqrt(delta)*u./Norm; 63 v=arrow*sqrt(delta)*v./Norm; 65 u=scalingfactor*sqrt(delta)*u./Norm; 66 v=scalingfactor*sqrt(delta)*v./Norm; 67 else 68 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 69 u=scalingfactor*sqrt(delta)*u./max(Norm); 70 v=scalingfactor*sqrt(delta)*v./max(Norm); 64 71 end 65 72 -
issm/trunk/src/m/classes/public/plot/plot_quiver3.m
r1744 r1878 10 10 % plot_quiver(md.x,md.y,md.z,md.vx,md.vy,md.vz,options_structure); 11 11 12 %keep only non NaN elements 13 pos=find(~isnan(x) & ~isnan(y) & ~isnan(z) & ~isnan(u) & ~isnan(v) & ~isnan(w)); 14 x=x(pos); y=y(pos); z=z(pos); 15 u=u(pos); v=v(pos); w=w(pos); 16 12 17 %get norm Min and Max 13 18 Norm=sqrt(u.^2+v.^2+w.^2); … … 17 22 %process options: scaling factor? 18 23 if isnan(options_structure.scaling), 19 arrow=0.40; 24 scalingfactor=0.40; 25 elseif isnumeric(options_structure.scaling), 26 scalingfactor=options_structure.scaling; 20 27 else 21 arrow=options_structure.scaling;28 error('plot_quiver error message: scaling option other than scalaer or ''off'' not supported yet') 22 29 end 23 30 … … 54 61 55 62 %Scale data 56 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 57 u=arrow*sqrt(delta)*u./Norm; 58 v=arrow*sqrt(delta)*v./Norm; 59 w=arrow*sqrt(delta)*w./Norm; 63 if ~isnan(options_structure.autoscale) & strcmpi(options_structure.autoscale,'off'), 64 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 65 u=scalingfactor*sqrt(delta)*u./Norm; 66 v=scalingfactor*sqrt(delta)*v./Norm; 67 else 68 delta=((min(x)-max(x))^2+(min(y)-max(y))^2)/numel(x); 69 u=scalingfactor*sqrt(delta)*u./max(Norm); 70 v=scalingfactor*sqrt(delta)*v./max(Norm); 71 end 60 72 61 73 %loop over the number of colors … … 69 81 70 82 %take care of colorbar 71 if 0 & ~strcmpi(options_structure.colorbar,'off'), 83 if ~strcmpi(options_structure.colorbar,'off'), 84 85 %build ticks 86 hcb=colorbar('peer',gca,'location','EastOutside'); 87 ticklabel=cell(1,length(levels)); 72 88 for i=1:length(levels), 73 scalevalues(i)=levels(i); 74 scalestring=[scalestring; sprintf('%8.4g',levels(i))]; 89 ticklabel{i}=num2str(round_ice(levels(i),3)); 75 90 end 76 set(colorbar,'YTickLabel',scalestring,'YTick',scalevalues); 77 error('debug') 91 tickpos=1:numcolors+1; 92 93 %remove ticks if to many have been created 94 proportion=round(length(levels)/10); 95 if proportion>1, 96 ticklabel=ticklabel(1:proportion:end); 97 tickpos=tickpos(1:proportion:end); 98 end 99 100 %draw colorbar 101 set(hcb,'YTickLabel',ticklabel,'YTick',tickpos); 102 %position 103 if ~isnan(options_structure.colorbarpos), 104 set(hcb,'Position',options_structure.colorbarpos); 105 end 106 %fontsize 107 if ~isnan(options_structure.fontsize), 108 fontsize=options_structure.fontsize; 109 else 110 fontsize=14; 111 end 112 set(hcb,'FontSize',fontsize); 78 113 end -
issm/trunk/src/m/classes/public/plot/plotdoc.m
r1805 r1878 83 83 disp(' ''alpha'': transparency coefficient (the higher, the more transparent). Default is 1.5'); 84 84 disp(' ''scaling'': scaling factor used by quiver plots. Default is 0.4'); 85 disp(' ''autoscale'': set to ''off'' to have all the quivers with the same size. Default is ''on'''); 85 86 disp(' ''expdisp'': plot exp file on top of a data plot. provide exp file as an argument (use a cell of strings if more than one)'); 86 87 disp(' ''expstyle'': marker style for expdisp plot (use a cell of strings if more than one)');
Note:
See TracChangeset
for help on using the changeset viewer.