Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure is uncropped when exporting to pdf in MatlabR2014b (with the latest export_fig) #32

Closed
yiqunyang2ep opened this issue Feb 1, 2015 · 5 comments

Comments

@yiqunyang2ep
Copy link

Hi,

First thanks a lot for providing such a wonderful toolbox!

However, here I've found a bug when I switch to Matlab 2014b. In Matlab R2014b, when I was using the toolbox to generate pdf figure as:

export_fig test -pdf -transparent

The margin of the figure is not cropped as desired. Could you have a look at it?

Thanks!

Example code:
figure(1)
plot(1:100,1:100)
xlabel('Frequency (Hz)')
ylabel('attenuation (Neper/m)')
set(gca,'fontsize',16)
export_fig test -pdf -transparent

capture

@ojwoodford
Copy link
Collaborator

It looks like you're not using the latest version of export_fig.

@pwstokes225
Copy link

I am using MATLAB R2014b with the latest version of export_fig.

I could reproduce, but only after changing the above fontsize from 16 to either 20, 24, 28 or 29. Other problematic values may exist as well.

Here is another plot where I found this issue to arise:

figure
ylabel('$$\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1+\sqrt{1}}}}}$$','Interpreter','latex')
export_fig  test -pdf

@yiqunyang2ep
Copy link
Author

Actually I'm using export_fig_16jan2015 with GS9.15 on 64bit Matlab R2014b. I believe it is the latest version..

@altmany
Copy link
Owner

altmany commented Feb 24, 2015

I've just committed a fix to the problem - it was caused by the fact that sometimes Matlab's print() function decides to place the %%BoundingBox x y w h section at the end of the EPS file rather than at the top, and this creates havoc... Moving this section to the top of the file fixes everything. Oliver already had code that does this, but the regexp that he used did not catch all of the cases, specifically those that had negative x/y values.

@altmany altmany closed this as completed Feb 24, 2015
@yiqunyang2ep
Copy link
Author

Thanks a lot for solving this problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants