MATLAB Answers

Sam Alex

The shape of lines in a figure

Asked by Sam Alex
on 29 Dec 2012


Why do the drawn lines in my figure look thin and not smooth curved lines? In this link you will see the first figure (my figure) and in the second one is the target (just black and white, thicker lines and smooth drawing lines):



Walter Roberson
on 30 Dec 2012

Posting the images would have been easier on us. I dislike firing up MS Word. (Too many bad associations with Catbert-inspired paperwork.)

Jan Simon
on 30 Dec 2012

Where do the figures look as described? On the screen, when exported to a pixel image and magnified, when exported to an EPS, but after an import to Word only the pixel-preview is displayed on the screen, but when printed to paper or to a PDF the graphics are excellent?



No products are associated with this question.

2 Answers

Answer by Walter Roberson
on 30 Dec 2012

I would suggest plotting with no marker specified, with the default line stype ('-') and perhaps with a LineWidth given. LineWidth is in points and the default is 1/2 point.

The graph you showed appeared to either have markers or to be using '--.' line style.


Answer by Image Analyst
on 30 Dec 2012

Try adding this option to whatever function (plot, contour, etc.) you used to plot the curves:

..... 'LineWidth', 3, ........

That should thicken them up. LineWidth is a common option used by a bunch of functions.

Your plot (the top colored one) looks fine to me. I don't see broken line like Walter. Tell me what "the target" is and why it apparently rasterizes the plot and loses the colors. Because of the rasterization/quantization/digitization/sampling (whatever you want to call it) and the apparent anti-aliasing being done along with that, it gives a choppy appearance to the curves on the bottom plot on "the target" (whatever that is).

Inthe future, just upload a screenshot directly:


Sam Alex
on 30 Dec 2012

As long as I can not reproduce this figure for now, I will patiently wait for your Alpha 3 in a week. Hopefully it will be ready then


Sam Alex
on 30 Dec 2012

BTW, when I reproduced this figure it still did not give me drawing lines as smooth as yours in that figure! Any ideas here what is going on?

Malcolm Lidierth
on 30 Dec 2012


You should see no difference when the figure is saved to a vector format - that has no dependency of the screen resolution. Double-click the graph and choose Save As button in the Graph Editor GUI that appears and choose PDF/SVG output. Or choose Copy to clipboard (not Copy image) - that copies to PDF allowing high-quality graphs to be pasted straight into Word (again re-rendered - all using Apache Batik under the hood).

On screen, smoothness will vary with hardware, OS and the Java Virtual Machine being used - on a Mac for example with the Apple JVM using the Quartz graphics pipeline, the lines are pretty smooth. On Windows, you will likely see some wiggles. It may be worth updating to the latest JRE on Windows and activating Direct X via a java.opts file - much faster graphics then, too.

If you have any feature requests for MATLAB, do post them at I'll be checking there regularly.


Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today