"Matlab-like" plotting library

"Matlab-like" plotting library Commit Details

Date:2018-02-27 13:11:23 (6 months 23 days ago)
Author:Stéphane Mottelet
Commit:76
Parents: 75
Message:first stuff for 6.x porting
Changes:
M/trunk/plotlib/macros/_update_leaf.sci
M/trunk/plotlib/macros/subplot.sci
M/trunk/plotlib/macros/parseLim.sci
M/trunk/plotlib/builder.sce
M/trunk/plotlib/macros/plot.sci
M/trunk/plotlib/macros/buildmacros.sce
M/trunk/plotlib/macros/plotlib_rotate_handler.sci
M/trunk/plotlib/macros/_update_axes.sci
M/trunk/plotlib/macros/shg.sci
M/trunk/plotlib/macros/parseCaxis.sci
M/trunk/plotlib/macros/clf.sci
M/trunk/plotlib/macros/graphinit.sci

File differences

trunk/plotlib/macros/plot.sci
33
44
55
6
67
78
89
[lhs,rhs]=argn(0);
if ~rhs
pause
IMD=get(gcf(),'immediate_drawing');
set(gcf(),'immediate_drawing','off');
clf();
trunk/plotlib/macros/plotlib_rotate_handler.sci
2525
2626
2727
28
28
2929
3030
3131
_catched=h_matching;
_ref_angles=h_matching.rotation_angles;
_ref_position=[x,y,w,_h];
h.info_message="Plotlib message: left-click to stop rotation.';
h.info_message="Plotlib message: left-click to stop rotation.";
end
else
az=modulo(modulo(_catched(1).rotation_angles(2)-270,360)+360,360);
trunk/plotlib/macros/parseCaxis.sci
33
44
55
6
7
8
9
6
7
8
9
1010
11
11
1212
1313
1414
1515
1616
17
17
1818
1919
2020
select type(value)
case 10
select value
case 'auto'
out=list(ppty,'auto');
case 'manual'
out=list(ppty,'manual");
case "auto"
out=list(ppty,"auto");
case "manual"
out=list(ppty,"manual");
else
_error(sprintf('%s : unknown %s mode',typeOfPlot,ppty));
_error(sprintf("%s : unknown %s mode",typeOfPlot,ppty));
end
case 1
if length(value)==2
out=list(ppty,value(:)');
else
_error(sprintf('%s : %s vector must have the form [min max]',typeOfPlot,ppty));
_error(sprintf("%s : %s vector must have the form [min max]",typeOfPlot,ppty));
end
end
trunk/plotlib/macros/parseLim.sci
33
44
55
6
7
8
9
6
7
8
9
1010
11
11
1212
1313
1414
1515
1616
17
17
1818
1919
2020
select type(value)
case 10
select value
case 'auto'
out=list(ppty,'auto');
case 'manual'
out=list(ppty,'manual");
case "auto"
out=list(ppty,"auto");
case "manual"
out=list(ppty,"manual");
else
_error(sprintf('%s : unknown %s mode',typeOfPlot,ppty));
_error(sprintf("%s : unknown %s mode",typeOfPlot,ppty));
end
case 1
if length(value)==2
out=list(ppty,value(:)');
else
_error(sprintf('%s : %s vector must have the form [min max]',typeOfPlot,ppty));
_error(sprintf("%s : %s vector must have the form [min max]",typeOfPlot,ppty));
end
end
trunk/plotlib/macros/_update_axes.sci
184184
185185
186186
187
187
188188
189189
190190
......
198198
199199
200200
201
201
202202
203203
204204
ax.cube_scaling='off';
else
[h.XLim,h.XLimMode,h.YLim,h.YLimMode]=_ratio_one_lims(ax);
ax.data_bounds(1:4)=[h.XLim';h.YLim'];
ax.data_bounds(1:4)=[h.XLim(:);h.YLim(:)];
end
end
ax.data_bounds(:,k)=value(:);
else
[h.XLim,h.XLimMode,h.YLim,h.YLimMode]=_ratio_one_lims(ax);
ax.data_bounds(1:4)=[h.XLim';h.YLim'];
ax.data_bounds(1:4)=[h.XLim(:);h.YLim(:)];
end
ax.tight_limits='on';
trunk/plotlib/macros/graphinit.sci
1010
1111
1212
13
14
13
14
1515
1616
1717
......
4646
4747
4848
49
49
5050
51
51
5252
5353
5454
55
55
5656
5757
58
58
5959
6060
6161
......
8080
8181
8282
83
84
85
86
83
84
85
86
8787
8888
89
90
91
92
93
94
95
96
97
89
90
91
92
93
94
95
96
97
9898
9999
100
100
101101
102102
103103
104104
105105
106
106
107107
108108
109109
......
112112
113113
114114
115
115
116116
117117
118118
119119
120
121
120
121
122122
123123
124124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145145
146146
147147
......
163163
164164
165165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205205
206206
207
208
209
210
211
212
213
207
208
209
210
211
212
213
214214
215215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240240
241241
242
242
243243
244244
245245
246246
247247
248
248
249249
250250
251251
252
253
254
255
252
253
254
255
256256
257257
258
259
260
261
262
263
264
265
266
258
259
260
261
262
263
264
265
266
267267
268268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317317
318318
319
319
320320
321321
322
323
322
323
324324
325
326
327
328
325
326
327
328
329329
330
330
331331
332
333
334
332
333
334
335335
336336
337337
338
338
339339
340340
341341
......
348348
349349
350350
351
352
353
354
355
356
351
352
353
354
355
356
357357
358358
359359
......
361361
362362
363363
364
365
364
365
366366
367367
368368
// Initialisation of graphic state
%plotlib_global._SHADED_ENTITIES=['pcolor','surf','surfl','tripcolor','trisurf','trisurfl','fill','fill3'];
%plotlib_global._SURFACE_ENTITIES=[%plotlib_global._SHADED_ENTITIES,'mesh','trimesh'];
%plotlib_global._SHADED_ENTITIES=["pcolor","surf","surfl","tripcolor","trisurf","trisurfl","fill","fill3"];
%plotlib_global._SURFACE_ENTITIES=[%plotlib_global._SHADED_ENTITIES,"mesh","trimesh"];
%plotlib_global.MAXCOL=7; // Number of colors for edgecolor cycling (plot,plot3,etc.)
cmblack=[1 1 0; // We allocate a minimal colormap as a
clum = ([.298936021 .58704307445 .114020904255]*bg(:) >= .5) + 1;
if clum==1
cmap = cmblack;
simpletable=tlist(['simpletable';'y';'m';'c';'b';'g';'r';'w';'k'],[1 1 0],[1 0.5 1],[0 1 1],[0.25 0.25 1],[0.25 1 0.25],[1 .25 .25],[1 1 1],[0 0 0]);
simpletable=tlist(["simpletable";"y";"m";"c";"b";"g";"r";"w";"k"],[1 1 0],[1 0.5 1],[0 1 1],[0.25 0.25 1],[0.25 1 0.25],[1 .25 .25],[1 1 1],[0 0 0]);
else
simpletable=tlist(['simpletable';'y';'m';'c';'b';'g';'r';'k';'w'],[0.75 0.75 0],[0.75 0 0.75],[0 0.75 0.75],[0 0 1],[0 0.5 0],[1 0 0],[0 0 0],[1 1 1]);
simpletable=tlist(["simpletable";"y";"m";"c";"b";"g";"r";"k";"w"],[0.75 0.75 0],[0.75 0 0.75],[0 0.75 0.75],[0 0 1],[0 0.5 0],[1 0 0],[0 0 0],[1 1 1]);
cmap = cmwhite;
end
else
error('graphinit : background color specification must be a 3-vector')
error("graphinit : background color specification must be a 3-vector")
end
else
error('graphinit : background color specification must be a 3-vector')
error("graphinit : background color specification must be a 3-vector")
end
defaultColormap=jetcolormap(64);
cmap(12,:)=fg(:)';
figurePrivateProperties=[
'Colormaptable';
'simpleColorTable';
'margin';
'eventHandlers'];
"Colormaptable";
"simpleColorTable";
"margin";
"eventHandlers"];
figurePublicProperties=[
'OuterPosition' 'parsePosition'
'Position' 'parsePosition'
'Name' 'parseLabel'
'FixedColors' 'parseColormap'
'Colormap' 'parseColormap'
'Color' 'parseColor'
'BackgroundColor' 'parseColor'
'DoubleBuffer' 'parseOnOff'
'Visible' 'parseOnOff'];
"OuterPosition" "parsePosition"
"Position" "parsePosition"
"Name" "parseLabel"
"FixedColors" "parseColormap"
"Colormap" "parseColormap"
"Color" "parseColor"
"BackgroundColor" "parseColor"
"DoubleBuffer" "parseOnOff"
"Visible" "parseOnOff"];
%plotlib_global.figurePropertiesNames=list();
%plotlib_global.figurePropertiesNames=tlist(['figureProperties';convstr(figurePublicProperties(:,1))]);
%plotlib_global.figurePropertiesNames=tlist(["figureProperties";convstr(figurePublicProperties(:,1))]);
for i=1:size(figurePublicProperties,1);
%plotlib_global.figurePropertiesNames(convstr(figurePublicProperties(i,1)))=[figurePublicProperties(i,:)];
end
%plotlib_global.defaultFigureUserData=list();
%plotlib_global.defaultFigureUserData=tlist(['figureData'
%plotlib_global.defaultFigureUserData=tlist(["figureData"
figurePrivateProperties
figurePublicProperties(:,1)],...
[],...
[],...
[],...
[],...
'',...
"",...
cmap,...
defaultColormap,...
fbg,...
fbg,...
'off',...
'on');
"off",...
"on");
%plotlib_global.reqMatrixArgs=list();
%plotlib_global.reqMatrixArgs=tlist(['reqMxArgs';
'plot';
'semilogx';
'semilogy';
'loglog';
'mesh';
'surf';
'surfl';
'pcolor';
'plot3';
'quiver';
'quiver3';
'triplot';
'tripcolor';
'trimesh';
'trisurf';
'trisurfl';
'fill';
'fill3';
'image'],...
%plotlib_global.reqMatrixArgs=tlist(["reqMxArgs";
"plot";
"semilogx";
"semilogy";
"loglog";
"mesh";
"surf";
"surfl";
"pcolor";
"plot3";
"quiver";
"quiver3";
"triplot";
"tripcolor";
"trimesh";
"trisurf";
"trisurfl";
"fill";
"fill3";
"image"],...
[1;2],...
[1;2],...
[1;2],...
[1,2;3,4]);
%plotlib_global.prefViewType=list();
%plotlib_global.prefViewType=tlist(['prefViewType';
'plot';
'semilogx';
'semilogy';
'loglog';
'mesh';
'surf';
'surfl';
'pcolor';
'plot3';
'quiver';
'quiver3';
'triplot';
'tripcolor';
'trimesh';
'trisurf';
'trisurfl';
'fill';
'fill3';
'image'],...
'2d',...
'2d',...
'2d',...
'2d',...
'3d',...
'3d',...
'3d',...
'2d',...
'3d',...
'2d',...
'3d',...
'2d',...
'2d',...
'3d',...
'3d',...
'3d',...
'2d',...
'3d',...
'2d');
%plotlib_global.prefViewType=tlist(["prefViewType";
"plot";
"semilogx";
"semilogy";
"loglog";
"mesh";
"surf";
"surfl";
"pcolor";
"plot3";
"quiver";
"quiver3";
"triplot";
"tripcolor";
"trimesh";
"trisurf";
"trisurfl";
"fill";
"fill3";
"image"],...
"2d",...
"2d",...
"2d",...
"2d",...
"3d",...
"3d",...
"3d",...
"2d",...
"3d",...
"2d",...
"3d",...
"2d",...
"2d",...
"3d",...
"3d",...
"3d",...
"2d",...
"3d",...
"2d");
leafPrivateProperties=[
'typeOfPlot'
'parent'
'data_bounds'
'light'
'child'
'vertex_indices'
'indices'];
"typeOfPlot"
"parent"
"data_bounds"
"light"
"child"
"vertex_indices"
"indices"];
leafPublicProperties=[
'Faces' 'parseData'
'FaceVertexCData' 'parseData'
'Vertices' 'parseData'
'XData' 'parseData'
'YData' 'parseData'
'ZData' 'parseData'
'CData' 'parseData'
'CDataMapping' 'parseCDataMapping'
'UData' 'parseData'
'VData' 'parseData'
'WData' 'parseData'
'VertexNormals' 'parseData'
'FaceNormals' 'parseData'
'Color' 'parseColor'
'FaceColor' 'parseColor'
'EdgeColor' 'parseColor'
'LineWidth' 'parseLineStyle'
'LineStyle' 'parseLineStyle'
'Marker' 'parseMarker'
'MarkerSize' 'parseMarker'
'MarkerEdgeColor' 'parseColor'
'MarkerFaceColor' 'parseColor'
'AutoScaleFactor' 'parseFactor'
'DisplayName' 'parseLabel'];
"Faces" "parseData"
"FaceVertexCData" "parseData"
"Vertices" "parseData"
"XData" "parseData"
"YData" "parseData"
"ZData" "parseData"
"CData" "parseData"
"CDataMapping" "parseCDataMapping"
"UData" "parseData"
"VData" "parseData"
"WData" "parseData"
"VertexNormals" "parseData"
"FaceNormals" "parseData"
"Color" "parseColor"
"FaceColor" "parseColor"
"EdgeColor" "parseColor"
"LineWidth" "parseLineStyle"
"LineStyle" "parseLineStyle"
"Marker" "parseMarker"
"MarkerSize" "parseMarker"
"MarkerEdgeColor" "parseColor"
"MarkerFaceColor" "parseColor"
"AutoScaleFactor" "parseFactor"
"DisplayName" "parseLabel"];
%plotlib_global.leafPropertiesNames=list();
%plotlib_global.leafPropertiesNames=tlist(['leafProperties';convstr(leafPublicProperties(:,1))]);
%plotlib_global.leafPropertiesNames=tlist(["leafProperties";convstr(leafPublicProperties(:,1))]);
for i=1:size(leafPublicProperties,1);
%plotlib_global.leafPropertiesNames(convstr(leafPublicProperties(i,1)))=[leafPublicProperties(i,:)];
end
%plotlib_global.defaultLeafUserData=list();
%plotlib_global.defaultLeafUserData=tlist(['leafData'
%plotlib_global.defaultLeafUserData=tlist(["leafData"
leafPrivateProperties
leafPublicProperties(:,1)],...
[],[],%inf*[1 -1 1 -1 1 -1 1 -1],[-1 -1 1]',[],[],[],...
[],[],[],[],[],[],[],'scaled',[],[],[],[],[],...
'default','default','default',...
1,'default',...
'none',6,'default','none',0.9,'');
[],[],[],[],[],[],[],"scaled",[],[],[],[],[],...
"default","default","default",...
1,"default",...
"none",6,"default","none",0.9,"");
axesPrivateProperties=[
'legendHandle'
'legendType'
'colorbarHandle'
'colorbarPosition'
'currentColor'
'currentLineStyle'
'previousPosition'
'data_bounds'
'pretty_data_bounds'];
"legendHandle"
"legendType"
"colorbarHandle"
"colorbarPosition"
"currentColor"
"currentLineStyle"
"previousPosition"
"data_bounds"
"pretty_data_bounds"];
axesPublicProperties=[
'OuterPosition' 'parsePosition'
'Position' 'parsePosition'
'nextPlot' 'parseNextPlot'
'XDir' 'parseDir'
'YDir' 'parseDir'
'ZDir' 'parseDir'
'XColor' 'parseColor'
'YColor' 'parseColor'
'ZColor' 'parseColor'
'Color' 'parseColor'
'XTick' 'parseTicks'
'YTick' 'parseTicks'
'ZTick' 'parseTicks'
'XTickLabel' 'parseLabel'
'YTickLabel' 'parseLabel'
'ZTickLabel' 'parseLabel'
'XLabel' 'parseLabel'
'YLabel' 'parseLabel'
'ZLabel' 'parseLabel'
'Title' 'parseLabel'
'XGrid' 'parseOnOff'
'YGrid' 'parseOnOff'
'ZGrid' 'parseOnOff'
'XGridColor' 'parseColor'
'YGridColor' 'parseColor'
'ZGridColor' 'parseColor'
'DataAspectRatio' 'parseRatio'
'DataAspectRatioMode' 'parseLim'
'CLim' 'parseLim'
'XLim' 'parseLim'
'YLim' 'parseLim'
'ZLim' 'parseLim'
'CLimMode' 'parseLim'
'XLimMode' 'parseLim'
'YLimMode' 'parseLim'
'ZLimMode' 'parseLim'
'XScale' 'parseScale'
'YScale' 'parseScale'
'ZScale' 'parseScale'
'ColorOrder' 'parseColormap'
'LineStyleOrder' 'parseLineStyle'
'Visible' 'parseOnOff'
'XAxisLocation' 'parseAxisLocation'
'YAxisLocation' 'parseAxisLocation'
'ZAxisLocation' 'parseAxisLocation'
'Box' 'parseOnOff'
'View' 'parseView'
'Tag' 'parseLabel'];
"OuterPosition" "parsePosition"
"Position" "parsePosition"
"nextPlot" "parseNextPlot"
"XDir" "parseDir"
"YDir" "parseDir"
"ZDir" "parseDir"
"XColor" "parseColor"
"YColor" "parseColor"
"ZColor" "parseColor"
"Color" "parseColor"
"XTick" "parseTicks"
"YTick" "parseTicks"
"ZTick" "parseTicks"
"XTickLabel" "parseLabel"
"YTickLabel" "parseLabel"
"ZTickLabel" "parseLabel"
"XLabel" "parseLabel"
"YLabel" "parseLabel"
"ZLabel" "parseLabel"
"Title" "parseLabel"
"XGrid" "parseOnOff"
"YGrid" "parseOnOff"
"ZGrid" "parseOnOff"
"XGridColor" "parseColor"
"YGridColor" "parseColor"
"ZGridColor" "parseColor"
"DataAspectRatio" "parseRatio"
"DataAspectRatioMode" "parseLim"
"CLim" "parseLim"
"XLim" "parseLim"
"YLim" "parseLim"
"ZLim" "parseLim"
"CLimMode" "parseLim"
"XLimMode" "parseLim"
"YLimMode" "parseLim"
"ZLimMode" "parseLim"
"XScale" "parseScale"
"YScale" "parseScale"
"ZScale" "parseScale"
"ColorOrder" "parseColormap"
"LineStyleOrder" "parseLineStyle"
"Visible" "parseOnOff"
"XAxisLocation" "parseAxisLocation"
"YAxisLocation" "parseAxisLocation"
"ZAxisLocation" "parseAxisLocation"
"Box" "parseOnOff"
"View" "parseView"
"Tag" "parseLabel"];
%plotlib_global.defaultAxesUserData=list();
%plotlib_global.defaultAxesUserData=tlist(['axesData'
%plotlib_global.defaultAxesUserData=tlist(["axesData"
axesPrivateProperties
axesPublicProperties(:,1)],...
[],1,[],'off',[1 1],1,[0 0 1 1],[0 1 0 1 0 1 0 1],[0 1 0 1 0 1 0 1],...
[0 0 1 1],[0.1 0.1 0.8 0.8],'erase','normal','normal','normal',...
[],1,[],"off",[1 1],1,[0 0 1 1],[0 1 0 1 0 1 0 1],[0 1 0 1 0 1 0 1],...
[0 0 1 1],[0.1 0.1 0.8 0.8],"erase","normal","normal","normal",...
fg,fg,fg,bg,...
'auto','auto','auto',...
'auto','auto','auto',...
'','','','',...
'off','off','off',...
"auto","auto","auto",...
"auto","auto","auto",...
"","","","",...
"off","off","off",...
fg,fg,fg,...
[1 1 1],'auto',...
[1 1 1],"auto",...
[0 1],[0 1],[0 1],[0 1],...
'auto','auto','auto','auto',...
'linear','linear','linear',...
cmap(1:7,:),'-','on','bottom','left','left','on',[0 90],'');
"auto","auto","auto","auto",...
"linear","linear","linear",...
cmap(1:7,:),"-","on","bottom","left","left","on",[0 90],"");
%plotlib_global.axesPropertiesNames=list();
%plotlib_global.axesPropertiesNames=tlist(['axesProperties';convstr(axesPublicProperties(:,1))]);
%plotlib_global.axesPropertiesNames=tlist(["axesProperties";convstr(axesPublicProperties(:,1))]);
for i=1:size(axesPublicProperties,1);
%plotlib_global.axesPropertiesNames(convstr(axesPublicProperties(i,1)))=[axesPublicProperties(i,:)];
end
ax.foreground=12;
ax.hidden_axis_color=12;
ax.font_color=12;
ax.axes_visible='off';
ax.visible='on';
ax.filled='off';
ax.box='off';
ax.clip_state='on';
ax.tight_limits='off';
ax.axes_visible="off";
ax.visible="on";
ax.filled="off";
ax.box="off";
ax.clip_state="on";
ax.tight_limits="off";
ax.user_data=%plotlib_global.defaultAxesUserData;
win=gdf();
win.background=10;
win.user_data=%plotlib_global.defaultFigureUserData;
win.event_handler='plotlib_handler';
win.event_handler_enable='on';
win.event_handler="plotlib_handler";
win.event_handler_enable="on";
%plotlib_global.eventHandlers=list();
trunk/plotlib/macros/subplot.sci
8383
8484
8585
86
87
88
89
90
91
86
87
88
89
90
91
9292
9393
9494
end
_ind=find(win.user_data.eventHandlers=="plotlib_subplot_handler");
if _ind==[]
_add_event_handler(win,"plotlib_subplot_handler");
else
win.event_handler_enable='on';
end
//_ind=find(win.user_data.eventHandlers=="plotlib_subplot_handler");
//if _ind==[]
// _add_event_handler(win,"plotlib_subplot_handler");
//else
// win.event_handler_enable='on';
//end
win.immediate_drawing=IMD;
trunk/plotlib/macros/buildmacros.sce
1111
1212
1313
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
14
pathmacros=get_absolute_file_path('buildmacros.sce');
tbx_build_macros(TOOLBOX_NAME,pathmacros);
// Adaptations for Atoms compatibility (loader no longer called
// at workspace level).
%figureDa_i_h=generic_i_h;
%axesData_i_h=generic_i_h;
%leafData_i_h=generic_i_h;
fun=[
'gcf'
'gca'
'drawnow'
'subplot'
'colorbar'
'legend'
'plot'
'mesh'
'surf'
];
funcprot(0);
for i=1:size(fun,'*')
execstr(sprintf("clear %s; scilab_%s=%s;",fun(i),fun(i),fun(i)));
end
vars=['%figureDa_i_h'
'%axesData_i_h'
'%leafData_i_h'
'scilab_gcf'
'scilab_gca'
'scilab_drawnow'
'scilab_subplot'
'scilab_colorbar'
'scilab_legend'
'scilab_plot'
'scilab_mesh'
'scilab_surf'
];
for i=1:size(vars,'*')
execstr(sprintf('save(pathmacros+filesep()+''%s.bin'',%s)',vars(i),vars(i)));
end
mputl([mgetl(pathmacros+filesep()+'names');vars],pathmacros+filesep()+'names');
clear tbx_build_macros %figureDa_i_h %axesData_i_h %leafData_i_h scilab_uicontrol scilab_uimenu;
clear tbx_build_macros
trunk/plotlib/macros/_update_leaf.sci
4141
4242
4343
44
44
4545
4646
4747
if h.typeOfPlot=='plot3'
param3d1(h.XData,h.YData,h.ZData,flag=[0,0]);
else
plot2d(h.XData,h.YData,frameflag=9);
plot2d(h.XData,h.YData,frameflag=7);
end
_entity=gce();
trunk/plotlib/macros/clf.sci
11
22
3
4
5
6
7
3
4
5
6
7
8
9
10
11
12
813
914
1015
11
16
1217
13
14
15
16
17
18
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
1953
20
54
55
56
57
2158
22
23
24
25
26
27
28
29
30
31
32
33
59
60
61
62
3463
35
64
65
66
67
68
69
70
71
3672
37
38
39
40
41
42
43
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
4499
45
46
47
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
48147
49
148
149
50150
51
52
53
54
55
56
57
151
152
153
154
155
156
58157
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
158
159
160
161
162
163
164
165
166
167
109168
169
110170
111
112
171
172
173
174
175
176
113177
114
115
116
178
179
180
181
117182
118183
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
// Copyright (C) 2017 - Samuel GOUGEON
//
// Copyright (C) 2012 - 2016 - Scilab Enterprises
//
// This file is hereby licensed under the terms of the GNU GPL v2.0,
// pursuant to article 5.3.4 of the CeCILL v.2.1.
// This file was originally licensed under the terms of the CeCILL v2.1,
// and continues to be available under such terms.
// For more information, see the COPYING file which you should have received
// along with this program.
function clf(varargin)
nbArg = size(varargin);
nbArg = size(varargin);
if nbArg==0 then
h=get('current_figure')
job='clear'
elseif nbArg==1 then
if type(varargin(1))==1 then // win num given
num=varargin(1)
if nbArg==0 then
h = get("current_figure")
job = "clear"
elseif nbArg==1 then
if type(varargin(1))==1 then // win num given
num = varargin(1)
h = [];
for k = 1:size(num,"*")
h = [h ; get_figure_handle(num(k))];
end
job = "clear"
elseif type(varargin(1))==9 then // handle given
h = varargin(1);
job = "clear"
elseif typeof(varargin(1))=='pltlibH' then // plotlib handle given
h=varargin(1).handle;job='clear'
elseif type(varargin(1))==10 then // job given
h = get("current_figure");
job = varargin(1)
end
elseif nbArg==2 then
if type(varargin(1))==1 then // win num given
num = varargin(1)
h = [];
for k = 1:size(num,"*")
h = [h ; get_figure_handle(num(k))];
end
elseif type(varargin(1))==9 then // handle given
h = varargin(1);
end
job = varargin(2);
else
msg = _("%s: Wrong number of input argument(s): %d to %d expected.")
error(msprintf(msg, "clf", 0, 2))
end
h=[];for k=1:size(num,'*'),h=[h;get_figure_handle(num(k))];end
if and(job<>["clear","reset"]) then
msg = _("%s: Wrong value for input argument #%d: ''clear'' or ''reset'' expected.")
error(msprintf(msg, "clf", nbArg))
end
job='clear'
elseif type(varargin(1))==9 then // handle given
h=varargin(1);job='clear'
elseif typeof(varargin(1))=='pltlibH' then // plotlib handle given
h=varargin(1).handle;job='clear'
elseif type(varargin(1))==10 then // job given
h=get('current_figure')
job=varargin(1)
end
elseif nbArg==2 then
if type(varargin(1))==1 then // win num given
num=varargin(1)
nbHandles = size(h,"*");
if nbHandles == 0 then
return
end
h=[];for k=1:size(num,'*'),h=[h;get_figure_handle(num(k))];end
// check that all the handles are figures
for k = 1:nbHandles
curFig = h(k);
if curFig.type <> "Figure" & (curFig.type <> "uicontrol" | curFig.style <> "frame")
msg = _("%s: Wrong type for input argument #%d: A vector of ''Figure'' or ''Frame'' handle expected.")
error(msprintf(msg, "clf", 1))
end
end
elseif type(varargin(1))==9 then // handle given
h=varargin(1);
end
job=varargin(2);
else
error(msprintf(gettext("%s: Wrong number of input argument(s): %d to %d expected."), "clf", 0, 2));
end
// delete childrens
for k = 1:nbHandles
curFig = h(k)
if curFig.type == "uicontrol" then
haveAxes = %F;
for kChild = 1:size(curFig.children, "*")
if curFig.children(kChild).type=="Axes" then
haveAxes = %T;
break
end
end
delete(curFig.children);
if haveAxes then
newaxes(curFig);
end
else
// Forces drawlater
immediateMode = curFig.immediate_drawing;
curFig.immediate_drawing = "off";
delete(curFig.children);
curFig.info_message = ""; // Clears the infobar message
curFig.event_handler_enable = "off"; // Disables the event handler
// Restores the drawlater entry status:
curFig.immediate_drawing = immediateMode;
end
end
if and(job<>['clear','reset']) then
error(msprintf(gettext("%s: Wrong value for input argument #%d: ''clear'' or ''reset'' expected."), "clf", nbArg));
end
// reset figures to default values if needed
if (job == "reset") then
defaultFig = gdf();
// This literal list should be replaced with a getproperties(gdf())
// when such a function will be available:
allprops = [
"children"
"figure_position"
"figure_size"
"axes_size"
"auto_resize"
"viewport"
"figure_name"
"figure_id"
"info_message"
"color_map"
"pixel_drawing_mode"
"anti_aliasing"
"immediate_drawing"
"background"
"visible"
"rotation_style"
"event_handler"
"event_handler_enable"
"user_data"
"resizefcn"
"closerequestfcn"
"resize"
"toolbar"
"toolbar_visible"
"menubar"
"menubar_visible"
"infobar_visible"
"dockable"
"layout"
"layout_options"
"default_axes"
"icon"
"tag"
];
excluded0 = ["children" "figure_id" "dockable" "menubar" "toolbar" "immediate_drawing"]
excluded0 = [excluded0 "layout" "layout_options"] // http://bugzilla.scilab.org/14955
for k = 1: nbHandles
curFig = h(k);
if curFig.type == "uicontrol" then
continue;
end
nbHandles = size(h,'*');
// Forces drawlater mode
curFig.immediate_drawing = "off";
// check that all the handles are figures
for k=1:nbHandles
curFig = h(k);
if curFig.type <> 'Figure' then
error(msprintf(gettext("%s: Wrong type for input argument #%d: A vector of ''Figure'' handle expected."), "clf", 1));
end
end
// properties to set
excluded = excluded0
if isDocked(curFig) // http://bugzilla.scilab.org/11476
excluded = [excluded "figure_position" "figure_size" "axes_size"]
end
defaultProps = setdiff(allprops, excluded);
// delete childrens
for k=1:nbHandles
curFig = h(k)
// drawlater
immediateMode = curFig.immediate_drawing;
curFig.immediate_drawing = 'off';
delete(curFig.children);
// drawnow
curFig.immediate_drawing = immediateMode;
end
// reset figures to default values if needed
if (job == 'reset') then
defaultFig = gdf();
for k = 1: nbHandles
curFig = h(k);
// drawlater
immediateMode = curFig.immediate_drawing;
curFig.immediate_drawing = 'off';
// properties to set
defaultProps=['figure_position',
'axes_size',
'auto_resize',
'viewport',
'figure_name',
'color_map',
'info_message',
'pixmap',
'pixel_drawing_mode',
'immediate_drawing',
'background',
'visible',
'rotation_style',
'event_handler',
'event_handler_enable',
'user_data',
'tag'];
for i = 1:size(defaultProps,'*')
defaultValue = get(defaultFig, defaultProps(i));
if (defaultProps(i) <> "figure_position" | defaultValue <> [-1,-1]) then
// don't reset figure pos is defaultValue is [-1,-1]
set(curFig, defaultProps(i), defaultValue);
end
// Settings
for i = 1:size(defaultProps,"*")
defaultValue = get(defaultFig, defaultProps(i));
if (defaultProps(i) <> "figure_position" | defaultValue <> [-1,-1]) then
// don't reset figure pos is defaultValue is [-1,-1]
set(curFig, defaultProps(i), defaultValue);
end
end
set(curFig, "immediate_drawing", defaultFig.immediate_drawing)
end
end
endfunction
// drawnow
curFig.immediate_drawing = immediateMode;
function yn = isDocked(fh)
// http://fileexchange.scilab.org/toolboxes/360000
sf = size(fh)
fh = fh(:)
fs = matrix(fh.figure_size,2,-1)'
as = matrix(fh.axes_size,2,-1)'
end
end
yn = (fh.dockable=="on" & ((fs(:,1)-as(:,1)) > 20)')
// A test on vertical dimensions is more complicated, due to switchable
// menubar, toolbar and infobar.
yn = matrix(yn, sf)
endfunction
trunk/plotlib/macros/shg.sci
11
2
3
4
5
6
7
8
2
3
4
5
6
97
function shg(varargin)
win=get('current_figure');
if length(varargin)==0
show_window(win);
else
show_window(varargin(1));
end
if length(varargin)==0
set(get('current_figure'),"visible","on")
else
set(varargin(1),"visible","on")
end
endfunction
trunk/plotlib/builder.sce
1212
1313
1414
15
15
1616
1717
1818
end;
// ====================================================================
if ~with_module('development_tools') then
error(msprintf(gettext('%s module not installed."),'development_tools'));
error(msprintf(gettext("%s module not installed."),'development_tools'));
end
// ====================================================================
TOOLBOX_NAME = 'plotlib';

Archive Download the corresponding diff file

Revision: 76