How could I get a smooth curve by "plot" function?

I find that when I draw a line using plot function, the line is not smooth enough and have jagged edge. I have tried enlarging the data density of points, and still nothing has been improved. So, what should I do to get a smooth curve? Is this just a preference setting problem? Any suggestion will be helpful, and thank you very much.

답변 (3개)

Jan
Jan 2012년 4월 28일

2 개 추천

To insert a picture in a paper I'd suggest the Painters renderer and an export to EPS. While the preview picture e.g. in the screen view of Word looks rough, the lines are smooth when printed to paper or to a PDF.
The suggested export_fig does exactly this also, but with a lot of extra features.
The OpenGL renderer can export pixel images only, while Painters exports vector graphics also.
Walter Roberson
Walter Roberson 2012년 4월 27일

0 개 추천

There is no preference setting: the smoothness of the curve depends upon the resolution of the data and upon the amount of zooming that one has done.
That said, you may wish to experiment with the three different renderers, and in particular with
set(gcf, 'renderer', 'opengl')

댓글 수: 5

a=0:pi/10000:2*pi;
x=100*cos(a);
y=100*sin(a);
plot(x,y)
axis equal
xlim([-110,110])
ylim([-110,110])
I use the code above to test the renders,and save as several formats. But still the edge is jagged.
Is there other method?
Is it because you need it for a paper, or why do you want it to be smoother than that?
Yes, I will insert a pic into my paper. Actually, the "OpenGL" setting is useful, and also the "dpi" setting. When I set the figure with 600dpi, the exported pic seems good.
Still, one more question:when I print the dash line "-." under "OpenGL" and "600dpi", the dash line almost seems like a solid line. What should I do to make it seems normal as well as clear?
You should experiment with using the File Exchange contribution "export_fig".
Also, possibly the FEX contribution "plt" would be useful to you.

댓글을 달려면 로그인하십시오.

Richard
Richard 2012년 4월 27일

0 개 추천

you could use the smoothLine function from the file exchange:

댓글 수: 3

Thank you very much, Lestyn.
Jan
Jan 2012년 4월 28일
The SmoothLine function modifies the values between the measurement points. In a scientific paper this can be an important error.
Berks
Berks 2014년 12월 25일
There is nothing non-scientific about using SmoothLine. It only changes the interpolation between consecutive points from linear to non-linear - it is an interpolation either way. If you don't want to guess values between points, don't draw a line.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Graphics Performance에 대해 자세히 알아보기

제품

질문:

2012년 4월 27일

댓글:

2014년 12월 25일

Community Treasure Hunt

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

Start Hunting!

Translated by