Skip to content

Commit eb53c61

Browse files
committed
Two more cleansed of erasemode.
1 parent bbc8a81 commit eb53c61

File tree

2 files changed

+66
-65
lines changed

2 files changed

+66
-65
lines changed

crrplot.m

+26-27
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
% $Id: crrplot.m 226 2003-01-08 16:59:17Z driscoll $
2525

2626
% Parse input and initialize
27-
n = length(w);
2827
w = w(:);
2928
beta = beta(:);
3029
wr = wr(:);
@@ -50,7 +49,7 @@
5049
end
5150

5251
% Integer arguments must be converted to specific values
53-
if (length(re)==1) & (re == round(re))
52+
if (length(re)==1) && (re == round(re))
5453
if re < 1
5554
re = [];
5655
else
@@ -59,7 +58,7 @@
5958
re([1,m+2]) = [];
6059
end
6160
end
62-
if (length(im)==1) & (im == round(im))
61+
if (length(im)==1) && (im == round(im))
6362
if im < 1
6463
im = [];
6564
else
@@ -77,10 +76,10 @@
7776
ax = [findobj(fig,'tag','PhysicalAxes');...
7877
findobj(fig,'tag','CanonicalAxes')];
7978
if length(ax)==2
80-
draw2 = logical(1);
79+
draw2 = true;
8180
vis = get(ax,'vis');
8281
else
83-
draw2 = logical(0);
82+
draw2 = false;
8483
ax = gca;
8584
vis = {'on'};
8685
end
@@ -113,7 +112,6 @@
113112
if ~draw2
114113
linh = linh(:,1);
115114
end
116-
set(linh,'erasemode','normal')
117115

118116
% Force redraw to get clipping enforced
119117
refresh
@@ -168,11 +166,11 @@
168166

169167
% Test points at ends and mindpoints of intervals
170168
if strcmp(direcn(1:3),'ver')
171-
testint = val(j) + i*mean(interval);
172-
testedge = val(j) + i*srtcross;
169+
testint = val(j) + 1i*mean(interval);
170+
testedge = val(j) + 1i*srtcross;
173171
else
174-
testint = i*val(j) + mean(interval);
175-
testedge = i*val(j) + srtcross;
172+
testint = 1i*val(j) + mean(interval);
173+
testedge = 1i*val(j) + srtcross;
176174
end
177175

178176
% Use test points to determine number of curves
@@ -193,30 +191,30 @@
193191
%zp(find(~diff(zp))) = [];
194192

195193
if strcmp(direcn(1:3),'ver')
196-
zp = val(j) + i*zp;
194+
zp = val(j) + 1i*zp;
197195
else
198-
zp = i*val(j) + zp;
196+
zp = 1i*val(j) + zp;
199197
end
200198

201199
% Prepare for iterative mapping
202200
lenzp = length(zp);
203-
new = logical(ones(lenzp,1));
201+
new = true(lenzp,1);
204202
wp = NaN*ones(lenzp,numcurves);
205203
qn = NaN*ones(lenzp,numcurves);
206204
iter = 0;
207205

208206
color = 'k';
209207

210208
% The individual points will be shown as they are found
211-
linh(j,1) = line(NaN,NaN,'parent',ax(1),'color',color,'vis',vis{1},...
212-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
209+
linh(j,1) = animatedline('parent',ax(1),'color',color,'vis',vis{1},...
210+
'linestyle','none','marker','.','markersize',7);
213211
if draw2
214-
linh(j,2) = line(NaN,NaN,'parent',ax(2),'color',color,'vis',vis{2},...
215-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
212+
linh(j,2) = animatedline('parent',ax(2),'color',color,'vis',vis{2},...
213+
'linestyle','none','marker','.','markersize',7);
216214
end
217215

218-
% Do the mapping & plotting
219-
while any(new) & (iter < maxrefn)
216+
% Do the mapping && plotting
217+
while any(new) && (iter < maxrefn)
220218
drawnow
221219

222220
% Map new points
@@ -242,10 +240,11 @@
242240
[wp,qn] = crrsort(wp,qn,Q);
243241

244242
% Update the points to show progress
245-
set(linh(j,1),'xdata',real(wp(:)),'ydata',imag(wp(:)))
243+
addpoints(linh(j,1),real(wp(new)),imag(wp(new)))
246244
if draw2
247-
set(linh(j,2),'xdata',real(zp),'ydata',imag(zp))
245+
addpoints(linh(j,1),real(zp(new)),imag(zp(new)))
248246
end
247+
drawnow update
249248

250249
iter = iter + 1;
251250

@@ -261,14 +260,14 @@
261260
wp(size(wp,1)+1,:) = NaN*wp(1,:);
262261

263262
% Set the lines to be solid
264-
set(linh(j,1),'erasemode','back')
265-
set(linh(j,1),'marker','none','linestyle','-')
266-
set(linh(j,1),'xdata',real(wp(:)),'ydata',imag(wp(:)),'user',zp)
263+
clearpoints(linh(j,1))
264+
addpoints(linh(j,1),real(wp),imag(wp));
265+
set(linh(j,1),'marker','none','linestyle','-','user',zp)
267266
if draw2
268267
% Replace the points with the endpoints
269-
set(linh(j,2),'erasemode','back')
270-
set(linh(j,2),'marker','none','linestyle','-',...
271-
'xdata',real(zp([1 end])),'ydata',imag(zp([1 end])))
268+
clearpoints(linh(j,2))
269+
addpoints(linh(j,2),real(zp([1 end])),imag(zp([1 end])))
270+
set(linh(j,2),'marker','none','linestyle','-')
272271
end
273272
drawnow
274273

deplot.m

+40-38
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
% Copyright 1998 by Toby Driscoll.
2525
% $Id: deplot.m 226 2003-01-08 16:59:17Z driscoll $
2626

27-
n = length(w);
2827
beta = beta(:);
2928
z = z(:);
3029

@@ -46,18 +45,18 @@
4645
end
4746

4847
% Integer arguments must be converted to specific values
49-
if (length(R)==1) & (R == round(R))
48+
if (length(R)==1) && (R == round(R))
5049
m = R+2;
5150
R = fliplr(linspace(.25,1,m));
5251
R([1,m]) = [];
5352
end
54-
if (length(theta)==1) & (theta == round(theta))
53+
if (length(theta)==1) && (theta == round(theta))
5554
m = theta+1;
5655
theta = linspace(0,2*pi,m);
5756
theta(m) = [];
5857
end
5958

60-
autoscale = strcmp(get(gca,'xlimmode'),'auto') & ...
59+
autoscale = strcmp(get(gca,'xlimmode'),'auto') && ...
6160
strcmp(get(gca,'ylimmode'),'auto');
6261
autoscale = autoscale | ~ishold;
6362

@@ -69,10 +68,10 @@
6968
ax = [findobj(fig,'tag','PhysicalAxes');...
7069
findobj(fig,'tag','CanonicalAxes')];
7170
if length(ax)==2
72-
draw2 = logical(1);
71+
draw2 = true;
7372
vis = get(ax,'vis');
7473
else
75-
draw2 = logical(0);
74+
draw2 = false;
7675
ax = gca;
7776
vis = {'on'};
7877
end
@@ -112,45 +111,47 @@
112111
for j = 1:length(R)
113112
% Start with evenly spaced theta
114113
tp = linspace(0,2*pi,20)';
115-
new = logical(ones(length(tp),1));
116-
wp = repmat(NaN,size(new));
114+
new = true(length(tp),1);
115+
wp = NaN(size(new));
117116

118117
% The individual points will be shown as they are found
119-
linh(j,1) = line(NaN,NaN,'parent',ax(1),'color',color,'vis',vis{1},...
120-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
118+
linh(j,1) = animatedline('parent',ax(1),'color',color,'vis',vis{1},...
119+
'linestyle','none','marker','.','markersize',7);
121120
if draw2
122-
linh(j,2) = line(NaN,NaN,'parent',ax(2),'color',color,'vis',vis{2},...
123-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
121+
linh(j,2) = animatedline('parent',ax(2),'color',color,'vis',vis{2},...
122+
'linestyle','none','marker','.','markersize',7);
124123
end
125-
124+
126125
% Adaptively refine theta to make smooth curve
127126
iter = 0;
128-
while (any(new)) & (iter < maxrefn)
127+
while (any(new)) && (iter < maxrefn)
129128
drawnow
130-
zp = R(j)*exp(i*tp(new));
129+
zp = R(j)*exp(1i*tp(new));
131130
neww = demap(zp,w,beta,z,c,qdat);
132131
wp(new) = neww;
133132
iter = iter + 1;
134133

135134
% Update the points to show progress
136-
set(linh(j,1),'xdata',real(wp),'ydata',imag(wp))
135+
addpoints(linh(j,1),real(wp(new)),imag(wp(new)))
137136
if draw2
138-
set(linh(j,2),'xdata',R(j)*cos(tp),'ydata',R(j)*sin(tp))
137+
addpoints(linh(j,1),R(j)*cos(tp(new)),R(j)*sin(tp(new)))
139138
end
139+
drawnow update
140140

141141
% Add points to zp where necessary
142142
[tp,wp,new] = scpadapt(tp,wp,minlen,maxlen,axis);
143143

144144
end
145145
% Set the lines to be solid
146-
set(linh(j,1),'erasemode','back')
147-
set(linh(j,1),'marker','none','linestyle','-','user',R(j)*exp(i*tp))
146+
clearpoints(linh(j,1))
147+
addpoints(linh(j,1),real(wp),imag(wp));
148+
set(linh(j,1),'marker','none','linestyle','-','user',R(j)*exp(1i*tp))
148149
if draw2
149150
% Replace the points with (hopefully) a smooth circle
150-
tp = linspace(0,2*pi,101);
151-
set(linh(j,2),'erasemode','back')
152-
set(linh(j,2),'marker','none','linestyle','-',...
153-
'xdata',R(j)*cos(tp),'ydata',R(j)*sin(tp))
151+
tp = linspace(0,2*pi,361);
152+
clearpoints(linh(j,2))
153+
addpoints(linh(j,2),R(j)*cos(tp),R(j)*sin(tp))
154+
set(linh(j,2),'marker','none','linestyle','-')
154155
end
155156
drawnow
156157
end
@@ -161,46 +162,48 @@
161162
linh = gobjects(length(theta),2);
162163
for j = 1:length(theta)
163164
Rp = [0 linspace(.2,1,14)]';
164-
zp = Rp*exp(i*theta(j));
165-
new = logical(ones(length(zp),1));
166-
wp = repmat(NaN,size(new));
165+
zp = Rp*exp(1i*theta(j));
166+
new = true(length(zp),1);
167+
wp = NaN(size(new));
167168
new(1) = 0;
168169
wp(1) = Inf;
169170

170171
% The individual points will be shown as they are found
171-
linh(j,1) = line(NaN,NaN,'parent',ax(1),'color',color,'vis',vis{1},...
172-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
172+
linh(j,1) = animatedline('parent',ax(1),'color',color,'vis',vis{1},...
173+
'linestyle','none','marker','.','markersize',7);
173174
if draw2
174-
linh(j,2) = line(NaN,NaN,'parent',ax(2),'color',color,'vis',vis{2},...
175-
'linestyle','none','marker','.','markersize',7,'erasemode','none');
175+
linh(j,2) = animatedline('parent',ax(2),'color',color,'vis',vis{2},...
176+
'linestyle','none','marker','.','markersize',7);
176177
end
177178

178179
% Adaptively refine to make smooth curve
179180
iter = 0;
180-
while (any(new)) & (iter < maxrefn)
181+
while (any(new)) && (iter < maxrefn)
181182
drawnow
182183
neww = demap(zp(new),w,beta,z,c,qdat);
183184
wp(new) = neww;
184185
iter = iter + 1;
185186

186187
% Update the points to show progress
187-
set(linh(j,1),'xdata',real(wp),'ydata',imag(wp))
188+
addpoints(linh(j,1),real(wp(new)),imag(wp(new)))
188189
if draw2
189-
set(linh(j,2),'xdata',real(zp),'ydata',imag(zp))
190+
addpoints(linh(j,1),real(zp(new)),imag(zp(new)))
190191
end
192+
drawnow update
191193

192194
% Add points to zp where necessary
193195
[zp,wp,new] = scpadapt(zp,wp,minlen,maxlen,axis);
194196
end
195197

196198
% Set the lines to be solid
197-
set(linh(j,1),'erasemode','back')
199+
clearpoints(linh(j,1))
200+
addpoints(linh(j,1),real(wp),imag(wp));
198201
set(linh(j,1),'marker','none','linestyle','-','user',zp)
199202
if draw2
200203
% Replace the points with just the ends
201-
set(linh(j,2),'erasemode','back')
202-
set(linh(j,2),'marker','none','linestyle','-',...
203-
'xdata',[0 1]*cos(theta(j)),'ydata',[0 1]*sin(theta(j)))
204+
clearpoints(linh(j,2))
205+
addpoints(linh(j,2),[0 1]*cos(theta(j)),[0 1]*sin(theta(j)))
206+
set(linh(j,2),'marker','none','linestyle','-')
204207
end
205208
drawnow
206209
end
@@ -209,7 +212,6 @@
209212
if ~draw2
210213
linh = linh(:,1);
211214
end
212-
set(linh,'erasemode','normal')
213215

214216
refresh
215217

0 commit comments

Comments
 (0)