Why does OpenGL renderer keep white space around figures when saving?
1 view (last 30 days)
Given the same figure, choosing the OpenGL renderer over the Painters renderer produces superfluous white space when saving the figure. Here's a simple example:
% create a figure with full height and width
myplot = figure('units','normalized','outerposition',[0 0 1 1]);
set(gca,'Position',[0 0 1 1])
x = linspace(0,10);
y1 = sin(x);
y2 = sin(5*x);
The figure rendered with OpenGL looks like this (when opened in GIMP or similar):
The figure rendered with painters looks like this (when opened in GIMP or similar):
The plot rendered with Painters correctly snaps to the subplots, but I need to use the OpenGL renderer for my EPS figures in order to accommodate LaTeX characters which do not format correctly with Painters. What can I do to make OpenGL save the figures without the border white space?
Jan on 22 Aug 2017
The EPS export considers the PaperPosition and not the screen dimensions of the figure. Why this is different for OpenGL and Painters is not clear to me, but differences are expected:
OpenGL creates pixel graphics, while the Painters renderer can export vector data for the EPS export. Therefore you see a kind of screen shot in the EPS created using the OpenGL renderer.