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

Wolf, Michael Michael.Wolf at bezreg-muenster.nrw.de
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 statistik.uni-dortmund.de]
Gesendet: Freitag, 24. September 2004 09:00
An: Wolf, Michael
Cc: r-help at stat.math.ethz.ch
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 bezreg-muenster.nrw.de
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help