altmany / export_fig

A MATLAB toolbox for exporting publication quality figures
BSD 3-Clause "New" or "Revised" License
1.26k stars 364 forks source link

axis labels with pixel units get shifted in export #135

Open delyle opened 8 years ago

delyle commented 8 years ago

A minimal working example is below:

close all;
xlabel('x','units','pixels')
ylabel('y','units','pixels')
export_fig('test.png')

The result is as follows:

test

The x and y labels are shifted, when they should remain in the middle of their respective axes.

I am using MATLAB 2015b for Mac and the most recent version of export_fig (as of March 30, 2016).

altmany commented 8 years ago

It works ok on my Windows machine, so I assume that it could either be something specific to Mac, or perhaps to the figure's renderer - try to set the figure and/or export_fig to other renderers and see if this helps.

delyle commented 8 years ago

The painters renderer works well, it's opengl that causes the issue.

altmany commented 8 years ago

Please try to run print('test.png','-dpng') and see whether you see the same problem. In this case this would prove that this is an internal Matlab bug on Mac, and you should report it to MathWorks. Please report here what you find.

delyle commented 8 years ago

Running print('test.png','-dpng') gives the correct output, so I don't think it's an internal Matlab bug.