Axis tick labels changed upon export to EPS

Hi all,
Duplicate post from the discussion forum here:
because I think it's a reasonable question!
I am using Matlab R2010b.
I have manually changed the axis tick labels for some of my plots and am experiencing some weird behaviour.
I have saved the figures (.fig) and the axis tick marks are correct. I can export to PNG or PDF with no problems. When I export to EPS however the axis tick marks have been altered and are completely incorrect.
Fig file is here if you want to play with it:
Any ideas? Surely a bug if it is specific to EPS export?!
Thanks for any suggestions,
Gabriel

1 comentario

Arnaud Miege
Arnaud Miege el 26 de Abr. de 2011
The figure exports fine to EPS on my machine. Do you have Ghostscript and Ghostview installed?

Iniciar sesión para comentar.

 Respuesta aceptada

Gabriel Rosser
Gabriel Rosser el 27 de Abr. de 2011

4 votos

Fixed:
The problem with specifying your own axis tick labels is that the property (for the y-axis here) YTickLabelMode is set to manual but the property YTickMode remains at auto.
When exporting to EPS, for some very odd reason the figure must be slightly rescaled (which is not the case/the rescaling is different when choosing PDF or PNG). The tick positions are automatically reassigned, but the labels remain those specified manually. Result: unexpected and rubbish figures!
Setting the axis property YTickMode to manual fixes this.
Of course this is only a problem if the rescaling step causes the tick positions to change, so Oliver Woodford probably didn't observe this.
I still think this is buggy behaviour - why should one type of export cause figure resizing when another doesn't?
Thanks for your suggestions everybody!

10 comentarios

John Martin Nilsen
John Martin Nilsen el 1 de Ag. de 2012
thanks a lot... solved my problem! /john
Wenjie Ji
Wenjie Ji el 12 de Ag. de 2014
The same when exporting to JPG
Steven
Steven el 21 de Oct. de 2014
Editada: Steven el 21 de Oct. de 2014
For me also this problem arises when exporting to PDF!
But I have not been able to resolve it by changing tickmode to manual.
Any other solution?
Is this a bug?
Thanks!
Steven
Jan
Jan el 21 de Oct. de 2014
@Steven: Please open a new thread and post the relevant code there. I assume the mistake is concealed in "changing the tickmode to manual". How did you do this exactly?
Rotem Mairon
Rotem Mairon el 31 de Jul. de 2021
This bug is still relevant ten years later. Thank you so much, @Gabriel Rosser, for sharing such a simple and elegant solution!
Adriano
Adriano el 27 de Abr. de 2022
and 11 years later!
Palash Sarate
Palash Sarate el 13 de Dic. de 2023
and 12 year later
Ankush Kapoor
Ankush Kapoor el 11 de En. de 2024
And 13 years later!
Olivier
Olivier el 13 de Nov. de 2024
I think the problem is solved when you set ylim manually.

Iniciar sesión para comentar.

Más respuestas (1)

Matt Fig
Matt Fig el 26 de Abr. de 2011

0 votos

I only use this for exporting figures.

5 comentarios

Gabriel Rosser
Gabriel Rosser el 26 de Abr. de 2011
Nice function, thanks for pointing it out. Unfortunately it has exactly the same problem though - axis markings are messed up after exporting.
Matt Fig
Matt Fig el 26 de Abr. de 2011
I will notify the author, thanks.
Oliver Woodford
Oliver Woodford el 27 de Abr. de 2011
export_fig worked fine for me in R2010b on Windows 7 64-bit. The axis markings were as in the figure.
Gabriel Rosser
Gabriel Rosser el 27 de Abr. de 2011
Oh sorry Oliver I just realised you mean you tried export_fig with my actual figure? That's very strange. Only difference I can think is I'm running Linux 64bit. Anyway, thanks very much for trying it and see my answer below for the fix.
Oliver Woodford
Oliver Woodford el 27 de Abr. de 2011
Yes, I was using your figure. Anyway, glad you found a solution. If I can replicate the bug I may put a fix into export_fig.

Iniciar sesión para comentar.

Categorías

Preguntada:

el 26 de Abr. de 2011

Comentada:

el 13 de Nov. de 2024

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by