Turn off line smoothing (anti-aliasing) in 2014b?

6 次查看(过去 30 天)
Is there a way to turn off line smoothing for selected objects (line objects in particular) in 2014b? I mean, it's great and all, but for some graphics having perfectly unaliased lines is better. I tried setting the line smoothing property to off, but this seems to have no effect (and produces a warning)
Consider e.g. this:
figure
axes
line([0 1],[.5 .5])
line([.5 .5],[0 1])
For me this gives a perfect 1 pixel line for the horizontal line, but a lighter blue 2 pixel wide line for the vertical one.
(Resizing the axes makes the lines alternate between 1 and 2 pixels wide)

回答(1 个)

Sean de Wolski
Sean de Wolski 2014-12-12
编辑:Sean de Wolski 2014-12-12
fig = figure;
fig.GraphicsSmoothing = 'off';
plot(1:10)
  1 个评论
matt dash
matt dash 2014-12-13
That turns it off for the entire figure though, which is too restrictive for what I need. E.g. if i'm making a plot and manually drawing grid lines, i like a nice uniform grid, but i'd like to leave the main data series anti-aliased.
I found the "AlignVertexCenters" property, which turns off antialiasing at least for perfectly vertical or horizontal line segments. I think this will be adequate for most of my purposes. Unfortunately it looks like for patches this property only affects the edges, not the faces, so when plotting a patch with no edge, it still has slightly fuzzy borders. (E.g. i use patches to draw bar graphs, and they have this problem.)
Follow up question: AlignVertexCenters says it only works if your graphics card supports it. Can anyone tell me the consequence of setting this property on a computer that doesnt support it? Does it give an error or warning, or it just has no effect? I'm making GUIs for use on multiple platforms and i want to make sure they don't break.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Graphics Object Properties 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by