added performance plot legend, rolling normalization
This commit is contained in:
@@ -24,5 +24,13 @@ function obj = plotPerformance(obj)
|
||||
hold(obj.fPerf.Children(1), 'off');
|
||||
end
|
||||
|
||||
% Add legend
|
||||
agentStrings = repmat("Agent %d", size(obj.perf, 1) - 1, 1);
|
||||
for ii = 1:size(agentStrings, 1)
|
||||
agentStrings(ii) = sprintf(agentStrings(ii), ii);
|
||||
end
|
||||
agentStrings = ["Total"; agentStrings];
|
||||
legend(obj.fPerf.Children(1), agentStrings, 'Location', 'northwest');
|
||||
|
||||
obj.performancePlot = o;
|
||||
end
|
||||
@@ -40,13 +40,15 @@ function [obj] = updatePlots(obj, updatePartitions)
|
||||
|
||||
% Update performance plot
|
||||
if updatePartitions
|
||||
% find index corresponding to the current time
|
||||
nowIdx = [0; obj.partitioningTimes] == obj.t;
|
||||
% set(obj.performancePlot(1), 'YData', obj.perf(end, 1:find(nowIdx)));
|
||||
obj.performancePlot(1).YData(nowIdx) = obj.perf(end, nowIdx);
|
||||
for ii = 2:size(obj.performancePlot, 1)
|
||||
obj.performancePlot(ii).YData(nowIdx) = obj.perf(ii, nowIdx);
|
||||
end
|
||||
drawnow;
|
||||
end
|
||||
nowIdx = find(nowIdx);
|
||||
|
||||
% Re-normalize performance plot
|
||||
normalizingFactor = 1/max(obj.perf(end, 1:nowIdx));
|
||||
obj.performancePlot(1).YData(1:nowIdx) = obj.perf(end, 1:nowIdx) * normalizingFactor;
|
||||
for ii = 2:size(obj.performancePlot, 1)
|
||||
obj.performancePlot(ii).YData(1:nowIdx) = obj.perf(ii - 1, 1:nowIdx) * normalizingFactor;
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user