IRootLab
An Open-Source MATLAB toolbox for vibrational biospectroscopy
show_legend_only.m
Go to the documentation of this file.
1 %> @brief Alters position of figure to make only the legend appear inside inner the figure area
2 %> @file
3 %> @ingroup graphicsapi
4 %>
5 %> This pretty much inutilizes the figure for other purpose than saving the legend as an image.
6 %>
7 %> @sa save_legend.m
8 %
9 function show_legend_only()
10 fig_assert();
11 global SCALE;
12 hl = legend();
13 psavel = get(hl, 'Position');
14 
15 set(gca, 'position', [2.1, 0, 1.1, 0.1]); % Axis out of sight
16 
17 set(hl, 'Position', [0, 0, psavel(3), psavel(4)]); % Moves legend maintaining position
18 set(hl, 'Units', 'pixels'); % Changes unit of legend handle in order to transfer position information from the legend to the figure
19 p = get(hl, 'Position');
20 set(hl, 'Position', [p(1)+SCALE+1, p(2)+SCALE+1, p(3), p(4)]); % Shifts a bit so that the whole border is visible
21 set(gcf, 'Position', [0, 0, p(3)+scaled(3), p(4)+scaled(3)]);
function show_legend_only()
function scaled(in i)
Analysis Session (AS) base class.
Definition: as.m:6
function fig_assert()
function save_legend(in fn, in dpi)