Skip to content
Snippets Groups Projects
Commit e3e41085 authored by Lemmer, Jan's avatar Lemmer, Jan
Browse files

Merge branch '68-label-position-und-rotation' into 'development'

Closes #56, Fixes #68

See merge request !22
parents 8811f58f ed6c2674
No related branches found
No related tags found
3 merge requests!30Fix CI,!25Development,!22Closes #56, Fixes #68
Pipeline #578454 passed
...@@ -15,9 +15,10 @@ arguments ...@@ -15,9 +15,10 @@ arguments
figs (1,:) {mustBeFigure} figs (1,:) {mustBeFigure}
options.ProjectID (1,:) {mustBeText}= '' options.ProjectID (1,:) {mustBeText}= ''
options.Fontsize (1,1) {mustBeInteger} = 8 options.Fontsize (1,1) {mustBeInteger} = 8
options.Color (1,3) {mustBeNonnegative} = 0.65*[1 1 1] % grey
options.Location (1,:) {mustBeText} = 'east' options.Location (1,:) {mustBeText} = 'east'
options.Position (1,2) {mustBeVector} = [1,0.4] % default for east options.Position (1,2) {mustBeVector} = [1,0.4] % default for east
options.Rotation (1,1) {mustBeInteger} = 0 options.Rotation (1,1) {mustBeReal} = NaN
end end
if isempty(options.ProjectID) if isempty(options.ProjectID)
...@@ -41,16 +42,19 @@ end ...@@ -41,16 +42,19 @@ end
switch options.Location switch options.Location
case 'north' case 'north'
options.Position = [0.4,0.95]; options.Position = [0.4,0.95];
options.Rotation = 0; Rotation = 0;
case 'east' case 'east'
options.Position = [1,0.4]; options.Position = [1,0.4];
options.Rotation = 90; Rotation = 90;
case 'south' case 'south'
options.Position = [0.4,.02]; options.Position = [0.4,.02];
options.Rotation = 0; Rotation = 0;
case 'west' case 'west'
options.Position = [.05,0.4]; options.Position = [.05,0.4];
options.Rotation = 90; Rotation = 90;
case 'southeast'
options.Position = [0.8,.02];
Rotation = 0;
case 'custom' case 'custom'
% Check if Position is valid % Check if Position is valid
if ~all(0 <= options.Position & options.Position <= 1) if ~all(0 <= options.Position & options.Position <= 1)
...@@ -62,6 +66,10 @@ switch options.Location ...@@ -62,6 +66,10 @@ switch options.Location
options.Location = 'east'; options.Position = [1,0.4]; options.Location = 'east'; options.Position = [1,0.4];
end end
if ~isnan(options.Rotation)
Rotation = options.Rotation;
end
IDs = cell(numel(figs),1); IDs = cell(numel(figs),1);
for n = 1:numel(figs) for n = 1:numel(figs)
...@@ -72,10 +80,11 @@ for n = 1:numel(figs) ...@@ -72,10 +80,11 @@ for n = 1:numel(figs)
ylim =get(axes,'YLim'); ylim =get(axes,'YLim');
xlim =get(axes,'XLim'); xlim =get(axes,'XLim');
%ID %ID
position = [options.Position(1)*xlim(2), options.Position(2)*ylim(2)];
position = [options.Position(1), options.Position(2)];
text(axes,position(1),position(2), IDs{n},'Fontsize',options.Fontsize,... text(axes,position(1),position(2), IDs{n},'Fontsize',options.Fontsize,...
'Rotation',options.Rotation, 'VerticalAlignment','bottom','Color',... 'Rotation',Rotation, 'VerticalAlignment','bottom','Color',...
0.65*[1 1 1],'BackgroundColor','w'); options.Color,'BackgroundColor','w', 'Units', 'normalized');
set(figs(n),'Tag', IDs{n}); set(figs(n),'Tag', IDs{n});
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment