Changeset 13153
- Timestamp:
- 08/27/12 09:27:04 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/plot/plot_scatter.m
r13009 r13153 1 function plot_scatter(x,y,mksize,level), 1 function plot_scatter(x,y,level,options), 2 3 if nargin==3, options=pairoptions(); end 2 4 3 5 %check input … … 28 30 levels=round_ice(linspace(ylim(1),ylim(2),numcolors+1),2); 29 31 else 30 numcolors=30; 32 palette=getcolormap(options); 33 numcolors=size(palette,1); 31 34 levels=round_ice(linspace(Min,Max,numcolors+1),2); 32 palette=colormap(jet(numcolors));33 35 end 34 36 … … 45 47 for i=1:numcolors 46 48 pos=find(colorind==i); 47 hprime=plot (x(pos),y(pos),...48 'o','MarkerSize', mksize,'MarkerEdgeColor',palette(i,:),...49 hprime=plot3(x(pos),y(pos),ones(size(x(pos))),... 50 'o','MarkerSize',getfieldvalue(options,'MarkerSize',3),'MarkerEdgeColor',palette(i,:),... 49 51 'MarkerFaceColor',palette(i,:)); 50 52 hp=[hp;hprime]; … … 54 56 % format the colorbar 55 57 h = colorbar; 56 nlab = abs(nlab); % number of labels must be positive 57 set(h,'YLim',[1 numcolors]); % set colorbar limits 58 set(h,'YTick',linspace(1,numcolors,nlab)); % set tick mark locations 59 60 labels = cell(1,nlab); 61 tick_vals = linspace(Min,Max,nlab); 62 warning off MATLAB:log:logOfZero; 63 for i = 1:nlab 64 if min(log10(abs(tick_vals))) <= 3, fm = '%-4.0f'; % fixed 65 else fm = '%-4.0E'; % floating 66 end 67 labels{i} = sprintf(fm,tick_vals(i)); 68 end 69 warning on MATLAB:log:logOfZero; 70 71 % set tick label strings 72 set(h,'YTickLabel',labels); 73 %colorbar %one last time required sometimes 58 caxis([min(levels) max(levels)]); 74 59 end
Note:
See TracChangeset
for help on using the changeset viewer.