How to display smooth (high definition) curves with plot?

5 vues (au cours des 30 derniers jours)
Pedro Delcorral
Pedro Delcorral le 7 Mar 2017
Modifié(e) : Jan le 7 Mar 2017
This question concerns only the way a curve is displayed on the screen with plot(x,y), not the data. For example:
x=linspace(0,50,1000000);
plot(x,sin(x))
Displays the following plot:
And I would like to have something like this:
Notice that in the second graph, the curve is much smoother. The amount of data points is not the problem here, since we have 1000000 (one million) points. Also, I'm looking for a way to display it, not to export into an image file since after plotting it, I use getframe to copy the figure displayed and create a movie.
I have tried setting the figure property Renderer to painters, zbuffer and OpenGL, and none of them work.
Thank you

Réponse acceptée

Jan
Jan le 7 Mar 2017
Modifié(e) : Jan le 7 Mar 2017
A million data points is very much for this tiny image, which does not have 1 million pixels.
Please try (i cannot do this currently):
x = linspace(0, 50, 1000);
plot(x, sin(x), 'LineSmoothing', 'on');
If this does not work, there might be a problem with the OpenGL renderer. See https://www.mathworks.com/matlabcentral/answers/157696-line-smoothing-in-matlab2014b.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by