Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solves #73 for figure positioning #77

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Example_extract_ankle_artic_surf.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Example_extract_tibiofem_artic_surf.m
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 21 additions & 0 deletions get_figpos_artic_surf.m
Original file line number Diff line number Diff line change
@@ -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