This contribution provides functions for precisely placing a figure to a given screen location, like the upper left corner, the top half of the screen or the full screen. The figure is placed precisely adjacent to the screen borders and will not overlap the task bar at the screen bottom. In order to achieve this, the left and right borders of a figure as well as the height of the figure head, the menu bar etc. are obtained by analyzing a screen shot of a test figure.
Example 1:
fh = figure;
placefigure(fh, 'top left');
Example 2:
fh1 = figure;
fh2 = figure;
fh3 = figure;
fh4 = figure;
placefigure(fh1, [2 2 1 1]);
placefigure(fh2, [2 2 1 2]);
placefigure(fh3, [2 2 2 1]);
placefigure(fh4, [2 2 2 2]);
Run function placefiguredemo.m to start a demonstration of the capabilities of this package.
Known issues:
* The retrieval of the task bar height is expected to work only if the task bar is at the bottom of the screen. Further, the analysis of a screen shot is not extremely fail-safe. If it fails on your machine, please let me know.
* This package does not work under Octave, as the root/figure properties are different. |