Issue with datetime and export_fig

13 views (last 30 days)
jonas
jonas on 18 Sep 2018
Answered: jonas on 19 Sep 2018
For years I've never had any issues with datetime nor export_fig. However, today I noticed some erroneous datetime labels after exporting by export_fig. After hours of debugging, I was able to reproduce the issue by these lines of code:
td=datetime(2009:2016,1,2)
plot(td,td)
export_fig(1,'myfig','-png')
Basically the resulting image has different XTickLabels than what I see on the screen prior to exporting. The erroneous labels briefly appear the screen during the export but revert back to the correct ones after a few seconds. Interestingly enough, I do not get this issue if I change the days input to 1 instead of 2 in datetime, probably because the XTicks are exactly aligned with my data (?).
I can use print just fine, it's just export_fig that's being annoying. I am wondering:
  • Is it reproducible or is related to my local settings?
  • Does anyone know the cause?
  • Does anyone know a fix?
The attached images were exported by print and export_fig, respectively.

Answers (1)

jonas
jonas on 19 Sep 2018
After hours of debugging I finally updated to the newest release of export_fig (v 2.0.0.0). Issue resolved. Needless to say I feel a bit stupid.

Categories

Find more on Data Type Identification in Help Center and File Exchange

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!