I actually finally found an answer to this issue, which has been bugging me for ages! - It seem like a bug that can be fixed through setting the 'InvertHardcopy' property on the relevant figure to 'off' and instead set the figure background manually to white. So, a fix to the above code would be
figure1 = gcf;
figure1.InvertHardcopy = 'off';
figure1.Color = [1 1 1];
InvertHardcopy is supposed to set the figure background to white (as opposed to the default grey used in figure windows), but there seems to a be a bug that shows up sometimes when white structures are plotted. (Thanks to the forum posts https://www.mathworks.com/matlabcentral/newsreader/view_thread/70489 and https://www.mathworks.com/matlabcentral/newsreader/view_thread/104859 !)