AW: [R] How to improve the quality of curve/line plots?

Wolf, Michael Michael.Wolf at
Fri Sep 24 09:35:58 CEST 2004

Thanks for the tip using a smoothing technique before plotiing in order to get a curve instead of a line connecting the observations.

But that's not the solution for my main problem with the "unclean" line plot. In order to show my problem let's take this simple example:

> xval <- c(1, 2, 3, 4, 5, 6, 7, 8)
> yval <- c(10, 30, 40, 50, 70, 90, 100, 110)
> plot (xval, yval, type="l")

If you look to the result in the graphic window you will see that the line seems to exist of many points between the observations; e. g. between xval=1 and xval=2 the line contains 8 or more sublines. Perhaps, you can also observe a break of the line at xval=4. That's what I call an "unclean line". 

Even if you try to export the plot with the png command you can observe the same phenomenon. The line has not an exact appearance like Excel diagram plots. If there are no other techniques to get better line plots it seems to be a problem of the graphic output!? 

Michael Wolf

-----Ursprüngliche Nachricht-----
Von: Uwe Ligges [mailto:ligges at] 
Gesendet: Freitag, 24. September 2004 09:00
An: Wolf, Michael
Cc: r-help at
Betreff: Re: [R] How to improve the quality of curve/line plots?

Wolf, Michael wrote:

> Dear list,
> I'm using the windows version of R. When plotting a curve or a line for time series with annual data , e. g. GDP growth 1991-2003, the line seems to exist of a lot of smaller lines. Printing the results the curves and lines seems to be "unclean" (because of using small resolution bitmaps?). Comparing the result of R with the same results of Excel the lines in excel seems to havve a higher qualitiy. In Excel you also can produce curves instead of lines.
> Are there any possibilities how to improve the quality of the plots in R? How can R be influenced to plot "clean" lines with a higher resolution on the screen (I think it's not a question of the pdf- or png command.). Perhaps, it's a problem of the graphical possibilites of R because the most line plots which can be seen on the web have these problems.

Can you specify an example please? I cannot remember any "unclean" plot. 
In particular, no bitmaps are used to render graphics in R.

What I guess is that you have a line plot and each observation is connected with the subsequent one by a line. If you want to smooth it (and you think smoothing is appropriate here), you have to apply a smoothing technique before plotting.

Uwe Ligges

> Thanks,
> Dr. Michael Wolf
> Bezirksregierung Münster
> Dezernat 61
> Domplatz 1-3    48161 Münster
> Tel.:   ++ 49 (02 51) / 4 11 - 17 95
> Fax.:   ++ 49 (02 51) / 4 11 - 8 17 95
> E-Mail: michael.wolf at
> ______________________________________________
> R-help at mailing list
> PLEASE do read the posting guide! 

More information about the R-help mailing list