Hi so I am trying to plot a dynamic bar graph with Y axis tick marks from -90 to 90. When I do this on a non-dynamic bar graph the tick labels display properly. As soon as I make it dynamic they are all over the place.
Hopefully someone can see where I have gone wrong..
% Generate a random vector of -90 to +90 to simulate pitch.
pitch = 90*rand(1) - 90*rand(1);
%Static bar graph, y tick marks are working here
subplot(2,1,1);
bar(pitch);
set(gca,'YLim',[-90.5 90.5]);
set(gca,'YTick',[-90,-45,0,45,90]);
title('Pitch');
%Dynamic bar graph, y tick marks are not working here
subplot(2,1,2);
barGraph = bar(pitch);
set(gca,'YLim',[-90.5 90.5]);
set(gca,'YTick',[-90,-45,0,45,90]);
title('Pitch');
for j=1:1000,
pitch = 90*rand(1) - 90*rand(1);
set(barGraph,'YData',pitch);
drawnow;
pause(0.1);
end