[R] Re gression line w/ residuals - tuning the plot

Primoz PETERLIN primozz.peterlin at gmail.com
Fri Oct 2 22:55:20 CEST 2009


Many thanks to both who replied, Ulrike and Petr. Indeed, some playing
with the margin-sizing options solved my problem.

All the best, Primož

2009/9/29 Ulrike Groemping <groemping at bht-berlin.de>:
>
> Hello Primoz,
>
> with traditional graphics, you may want to use par (?par), options like mar,
> mai, oma etc. may be interesting for you. And for the relation between
> y-axis and x-axis, the option asp to function plot (?plot.default) will
> help.
>
> Regards, Ulrike
>
>
>
> Primoz PETERLIN-2 wrote:
>>
>> Hello everybody,
>>
>> I am sure this is a beginners' problem which is being asked
>> recurrently every few months, but nevertheless I wasn't able to find
>> the answer searching through the r-help list.
>>
>> So here is my problem: I would like to plot a set of points (y vs. x),
>> a (linear) regression line through them, and on the second graph
>> underneath the first one I would want to plot residuals vs. x. I came
>> up with two solutions, unfortunately neither of them is fully
>> satisfactory.
>>
>> First I tried with what I later learned is called traditional graphics
>> (file norris.R). Here, the white space margins around the plots are
>> too wide, meaning that the data in the plot are crammed. Probably I
>> would be quite happy if I could somehow define a rectangular plotting
>> area with its height being ~150% of its width, but I cannot prevent R
>> from offering me a square plotting area.
>>
>> Next I tried a lattice package (file norris.lattice.R). Here, the
>> margins are smaller, but the lower plot does not fit exactly under the
>> upper one (the x-axes should match).
>>
>> Most likely I am not using the correct terminology (if I would have
>> known it, I could have looked in the help pages myself, thank you :),
>> but I hope that the attached files make more sense of what I am trying
>> to do.
>>
>> Thanks in advance.
>>
>> All the best,
>> Primoz
>>
>> --
>> Primož Peterlin,   Inštitut za biofiziko, Med. fakulteta, Univerza v
>> Ljubljani
>> Lipičeva 2, SI-1000 Ljubljana, Slovenija.
>> primoz.peterlin at mf.uni-lj.si
>> Tel +386-1-5437612, fax +386-1-4315127,
>> http://biofiz.mf.uni-lj.si/~peterlin/
>> F8021D69 OpenPGP fingerprint: CB 6F F1 EE D9 67 E0 2F  0B 59 AF 0D 79 56
>> 19 0F
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Regression-line-w--residuals---tuning-the-plot-tp25647458p25670483.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Primož Peterlin,   Inštitut za biofiziko, Med. fakulteta, Univerza v Ljubljani
Lipičeva 2, SI-1000 Ljubljana, Slovenija.        primoz.peterlin at mf.uni-lj.si
Tel +386-1-5437612, fax +386-1-4315127,  http://biofiz.mf.uni-lj.si/~peterlin/
F8021D69 OpenPGP fingerprint: CB 6F F1 EE D9 67 E0 2F  0B 59 AF 0D 79 56 19 0F




More information about the R-help mailing list