Axes background color does not display as expected when exporting video
Running Matlab R2011b under Linux, I am creating video using VideoWriter. My code looks something like this:
h_fig = figure(); set(h_fig, 'Visible', 'on') set(h_fig, 'Position', [300,200,898,720]); h_axs = axes('Parent', h_fig); set(h_axs,'nextplot','replacechildren'); vidObj = VideoWriter('leadfollow3.avi'); ... for i = 1:n h_axs_a = subplot(3,2,[1 2]); plot(h_axs_a, x, a_mag_lead, x, a_mag_follow, 'r'); ...
The plot consists of several subplots. The first subtask renders fine, but for the rest of the axes backgrounds remain gray rather than white. To make matters worse, it switches to white for some frames, resulting in annoying flickering in the video ( see video example here ). Portions outside the video loop do not display this artifact. What might be the best strategy to fix this problem?
Edit: After I got the chance to try this code on Windows, it seems like the problem is Linux-limited. However, I would still like to know about a possible solution since I do not have regular access to windows windows where I can do my calculations.
source to share