colorbar handle ?
Reported by Alain Lamy
colorbar.sci (5.20 KB, application/octet-stream)
modified "colorbar" function
It's not possible to easily get access to the colorbar graphic entity
("Axes" entity).
The only way is to do something something like :
colorbar(...)
f = gcf();
cb = f.children(1)
But this is not guaranteed to work in future versions of Scilab as it depends on the way children are ordered.
One more portable way is to make the colorbar function return the handle of the colorbar entity (the same way "legend" does).
Then it becomes easy to change some propoerties of the colorbar (font size, ...)
as shown in the example :
// --------------------------------
exec("colorbar.sci");
f = scf();
f.color_map = jetcolormap(10);
cb = colorbar(1,2); // => colorbar handle
cb.font_size = 3;
cb.font_style = 8;
// --------------------------------
Attached file: modified colorbar function (colorbar.sci)
List of changes in the colorbar function :
- output argument ("cb") added
- description of "cb" in function header
- cb value initialized just before "endfunction"