Minor tick spacing changes when saving figure to file

I would like to prevent the minor ticks from changing when I export a figure. Any idea how I do that? I have tried setting YTickMode to manual and that doesn't seem to help. Here is a picture of the figure (left) before exporting and (right) after exporting. I don't understand why the y minor tick spacing changes. I have tried both print() and export_fig() and they both exhibit the same behavior. This all started happening after I updated from 14b to 15b. YAY!!! I want to export what I see.

4 件のコメント

Kirby Fears
Kirby Fears 2015 年 11 月 6 日
編集済み: Kirby Fears 2015 年 11 月 6 日
I don't see a function called export_fig in 2014b.
What file format are you saving to? Have you tried saving to other file types such as pdf or emf, and does the problem persist?
Thomas
Thomas 2015 年 11 月 6 日
export_fig is a program written by a user that has been widely adopted as a preferred way to save figures to images. It has its limitations so I use print instead most of the time. I have tried vector graphics and bitmap image files and both have this problem. I likely have a hundred plots or more to generate so it is disappointing that I can't control more aspects of the matlab plots. I may have to turn off minor ticks on the main axis and superpose another axis with major tick spacing the way that I want the minor ticks to be spaced and just not label the major ticks on the superposed axis set. That is likely the workaround I will adopt.
Kirby Fears
Kirby Fears 2015 年 11 月 6 日
You can make a post about minor tick spacing in the export_fig link provided by Walter. Yair may have a solution or find a fix.

サインインしてコメントする。

回答 (2 件)

Usha Duddu
Usha Duddu 2015 年 11 月 11 日

0 投票

Hi Thomas
I understand that when you try exporting the figure either using "print" or "export_fig", minor yticks change their position in figure file.
This might happen because Y axis ticks in the figure are set to 'Auto' and Y axis is rescaled when the figure is resized for exporting.
One resolution to preserve the Y axis ticks from the original file to the exported file might be to uncheck the 'Auto' option for Y axis from "Edit->Axis Properties" from figure window. After doing the above setting, you could try exporting the figure through "print" command.
Hope this helps!
Thank you Usha
Ye
Ye 2016 年 5 月 18 日

0 投票

Previously, I met the same problem. Then I find out it depends on the size of figure window displayed in matlab before you print the figure. That is after I run my script, matlab will show a figure window, and that is what your later exported figure looks like. If you maximize the window, minor ticks will increase, vice versa.

カテゴリ

ヘルプ センター および File ExchangePrinting and Saving についてさらに検索

質問済み:

2015 年 11 月 6 日

回答済み:

Ye
2016 年 5 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by