Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
%PLOTMOUSEPOSTRACE(MOUSEPOS) generate a simple plot, showing the trace of the mouse over
% time
%
% Friedrich Kretschmer
% Max-Planck Institute for Brain Research
% sciclist@brain.mpg.de
function hFig = plotMousePosTrace(mousePos)
arenaSize = 1000; %in mm
innerZone1 = [300, 300, 400, 400];
innerZone2 = [100, 100, 800, 800];
innerZone3 = [50, 50, 900, 900];
colors(1,:) = [.8,.8,.8]./3;
colors(2,:) = [.8,.8,.8]./2;
colors(3,:) = [.8,.8,.8]./1;
hFig = figure;
rectangle('Position', innerZone3, 'LineWidth', 2, 'EdgeColor', colors(3,:), 'FaceColor', colors(3,:));
rectangle('Position', innerZone2, 'LineWidth', 2, 'EdgeColor', colors(2,:), 'FaceColor', colors(2,:));
rectangle('Position', innerZone1, 'LineWidth', 2, 'EdgeColor', colors(1,:), 'FaceColor', colors(1,:));
h(1) = line([0,0],[0,0], 'Color', colors(1,:), 'LineWidth', 10); %For legend only
h(2) = line([0,0],[0,0], 'Color', colors(2,:), 'LineWidth', 10); %For legend only
h(3) = line([0,0],[0,0], 'Color', colors(3,:), 'LineWidth', 10); %For legend only
hold on
plot(mousePos(:,1), mousePos(:,2), 'g', 'LineWidth', 2);
xlabel('Position x [mm]');
ylabel('Position y [mm]');
axis equal
xlim([0, arenaSize]);
ylim([0, arenaSize]);
set(gca, 'XTick', 0:100:arenaSize, 'YTick', 0:100:arenaSize);
hl = legend(h, {'Inner zone 1', 'Inner zone 2', 'Inner zone 3'}, 'Location', 'northeastoutside');
end