Skip to content
Snippets Groups Projects
scatterSatDataPositions.m 1.25 KiB
Newer Older
function [scatterHandle, textHandles] = scatterSatDataPositions(pAxesHandle, pSatDataPositions, pPlotAsMap)
leprob001's avatar
leprob001 committed
%SCATTERSATDATAPOSITIONS Summary of this function goes here
%   Detailed explanation goes here


%% Remove NaN
x = pSatDataPositions.lon_sat(~isnan(pSatDataPositions.lon_sat));
y = pSatDataPositions.lat_sat(~isnan(pSatDataPositions.lat_sat));
year = pSatDataPositions.year_sat(~isnan(pSatDataPositions.year_sat));
month = pSatDataPositions.month_sat(~isnan(pSatDataPositions.month_sat));
day = pSatDataPositions.day_sat(~isnan(pSatDataPositions.day_sat));

%% Calculate step size for text
leprob001's avatar
leprob001 committed

%% Prepare text cell
textCell = {};
for i = steps
    textCell{end + 1} = {'', ['  ' num2str(year(i)) '-' pad(num2str(month(i)), 2, 'left', '0') '-' pad(num2str(day(i)), 2, 'left', '0')]};
leprob001's avatar
leprob001 committed
end

%% Plot

% make handle the current axes
axes(pAxesHandle);

leprob001's avatar
leprob001 committed
hold(pAxesHandle, 'on');
if pPlotAsMap
    scatterHandle = scatterm(pAxesHandle, y, x, [], [.5 .5 .5]);
    textHandles = textm(y(steps), x(steps), textCell, 'FontSize', 7, 'Color', [.5 .5 .5]);
else
    scatterHandle = scatter(pAxesHandle, x, y, [], [.5 .5 .5]);
    textHandles = text(pAxesHandle, x(steps), y(steps), textCell, 'FontSize', 7, 'Color', [.5 .5 .5]);
end
leprob001's avatar
leprob001 committed
hold(pAxesHandle, 'off');

end