From 5bf24baee050b28ae4bc8672e8a3d0b5bd7c6922 Mon Sep 17 00:00:00 2001 From: Metin Bicer Date: Wed, 18 Nov 2020 18:37:40 +0000 Subject: [PATCH 1/2] create function for figure positioning --- get_figpos_artic_surf.m | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 get_figpos_artic_surf.m diff --git a/get_figpos_artic_surf.m b/get_figpos_artic_surf.m new file mode 100644 index 0000000..b270bb3 --- /dev/null +++ b/get_figpos_artic_surf.m @@ -0,0 +1,21 @@ +function figPos = get_figpos_artic_surf(varargin) +mp = get(0, 'MonitorPositions'); %gets the monitor position(s) + +if size(mp,1) > 1 % if there is more than 1 monitor + indMonitor = find(strncmpi(varargin(1:2:end), 'Monitor', 3)); % Monitor argument + if ~isempty(indMonitor) + % if 'Monitor' argument is passed + % positions of the selected monitor + mp = mp(cell2mat(varargin(indMonitor(end)+1)),:); + else + % else the largest screen is selected to plot + mp = mp(prod(mp,2) == max(prod(mp,2)), :); + end +end + +left = mp(1) + mp(3)/5; % leftFig = leftMonitor + widthMonitor/5 +bottom = mp(2) + mp(4)/5; % bottomFig = bottomMonitor + heightMonitor/2 +width = 2*mp(3)/3; % widthFig = widthMonitor +height = 2*mp(4)/3; % heightFig = heightMonitor +figPos = [left, bottom, width, height]; +end \ No newline at end of file From 850debfc08b86720ca36affe976d4504de52a1a0 Mon Sep 17 00:00:00 2001 From: Metin Bicer Date: Wed, 18 Nov 2020 18:39:54 +0000 Subject: [PATCH 2/2] [examples] add function call to position figures properly --- Example_extract_ankle_artic_surf.m | 2 +- Example_extract_tibiofem_artic_surf.m | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Example_extract_ankle_artic_surf.m b/Example_extract_ankle_artic_surf.m index 8d0e561..f800c2f 100644 --- a/Example_extract_ankle_artic_surf.m +++ b/Example_extract_ankle_artic_surf.m @@ -76,7 +76,7 @@ % GIBOC_tibia.m the exported triangulations can be customized. % plot the articular surfaces and nearby bone - figure('Name', dataset_name, 'Position', [626 502 1175 459]) + figure('Name', dataset_name, 'Position', get_figpos_artic_surf()) % talocrural art surf on tibial side subplot(1,2,1) diff --git a/Example_extract_tibiofem_artic_surf.m b/Example_extract_tibiofem_artic_surf.m index b17e1e4..0879d7f 100644 --- a/Example_extract_tibiofem_artic_surf.m +++ b/Example_extract_tibiofem_artic_surf.m @@ -77,7 +77,7 @@ % GIBOC_tibia.m the exported triangulations can be customized. % plot the articular surfaces and nearby bone - figure('Name', dataset_name, 'Position', [626 502 1175 459]) + figure('Name', dataset_name, 'Position', get_figpos_artic_surf()) % distal femur and articular surface of individual condyles subplot(1, 2, 1)