How can I make the errorbars vertically centered around the markers? I am using Matlab2016b.

2 ビュー (過去 30 日間)
For data x, y and e, I simply used
errorbar(x,y,e,'ro');
and saved the figure as eps or pdf. In the resulting figure, the errorbars are always not perfectly centered around the markers. Below is the example.
I am wondering if there is any way to adjust the position the those errorbars?

採用された回答

Amy
Amy 2017 年 10 月 26 日
Hi Luwei,
Unfortunately, what you are seeing is a bug in R2016b that the relevant team is aware of.
Is the marker offset visible even before you save the figure?
Make sure the 'PaperPositionMode' of the figure to is set 'auto' (see this page for more details on figure properties).
Also, instead of using 'File->Save as...' to save the figure, try either the saveas or print functions.
  3 件のコメント
Amy
Amy 2017 年 10 月 26 日
If it isn't important that the figure be saved as a vector file, have you tried '-opengl' as the renderer instead?
Luwei Ge
Luwei Ge 2017 年 10 月 26 日
編集済み: Luwei Ge 2017 年 10 月 26 日
I just tried and please see the attached screenshot as the result. I have to say this offset is not always present on all data points. The issue gets more significant typically when the line width is set to be bigger.
Meanwhile, for what I am working on, vector images are almost always preferable..

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

その他の回答 (1 件)

Jens De Pelsmaeker
Jens De Pelsmaeker 2017 年 11 月 21 日

Hi Lewei and Amy,

I am currently struggling with the same problem, trying to look for a solution, which is how I ended up on this thread. I am using MATLAB 2017b prerelease version.

Amy's suggestion of changing the PaperPositionMode to 'auto' has fixed the problem for me in matlab itself, before saving, but when saving to eps using 'saveas(gcf, ,'epsc'), the figures look like the misaligned original below, where the green dots are clearly slightly offset to the left of the vertical lines instead of properly centered:

Sadly, this forms quite a problem for me (and an urgent one), as I am currently using matlab to create several figures of this type to be included in the manuscript for the defense of my PhD, due in a matter of weeks. Everything is in vector format as the manuscript is written in LaTeX.

Amy, seeing that you mentioned this is caused by a bug, is there any solution in sight or should I look for a different method of creating my figures?

Many thanks in advance, Jens

  1 件のコメント
Amy
Amy 2017 年 12 月 4 日
Hi, sorry for the delay in getting back to you. When 'PaperPositionMode' is set to auto, the printed generated output should preserve the onscreen layout.
After setting 'PaperPositionMode' and before printing, make sure that the onscreen figure is sized appropriately for the content. Note this may require resizing the docked figure container, or undocking the figure and then resizing that.
If you are still running into this issue, consider opening a technical support case about it here.

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

カテゴリ

Help Center および File ExchangeErrorbars についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by