[R] R plot

Wacek Kusnierczyk Waclaw.Marcin.Kusnierczyk at idi.ntnu.no
Fri Oct 17 11:59:11 CEST 2008


it might be that for some purposes non-resizing graphs are useful; 
perhaps a graphical parameter that would allow the user to specify
whether the plot is to be automatically resized or not would be useful,
e.g.,

plot(..., resizable=T)

and then points(...) would cause the plot to adapt the scale.  and that
would help to market r as a modern language, i guess.  (btw. how does
one classify a language as modern or not?)

vQ

(Ted Harding) wrote:
> On 17-Oct-08 09:01:08, Benoit Boulinguiez wrote:
>   
>> Hi,
>> Personally I always use xlim and ylim with the plot or points
>> function like that:
>>
>> plot( X,Y,pch=16,col=2,cex.axis=1.5,cex.lab=1.5,
>>       xlim=c(0,1.05*max(X)),ylim=c(0,1.05*max(Y))
>>       )
>>
>> Regards/Cordialement
>> Benoit Boulinguiez 
>>     
>
> I think (from his original post) that Haoda already knows about
> the use of xlim and ylim. What he finds annoying is "keeping track"
> of what they should be!
>
> Here, I'm afraid, I am inclined to agree with him. For example,
> if you want to plot say 10 time series, with different time-ranges
> and different value-ranges, all on the one graph, and they have
> to be obtained separately (even by reading in from 10 different
> data files), then the only way I have found is to wait until all
> the objects are available, then compute the min and max of the
> x-range and the y-range of each, and finally base xlim on the
> min of the min x-ranges and the max of the max x-ranges (and
> similarly for ylim). Of course you could alternatively do this
> cumulatively as you go along, and even build the process into
> a function. But it is a lot of "admin" along the way, and it can
> get complicated.
>
> This sort of thing has caused me a lot of extra work on many
> occasions, which would have been unnecessary if plots could
> "re-size" themselves when asked to go outside existing ranges.
> I grin and bear it, because that's how things work; but I have
> to admit that I don't like it!
>
> Best wishes to all,
> Ted.
>
>
>   
>> -----Message d'origine-----
>> De : r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
>> De
>> la part de Wacek Kusnierczyk
>> Envoyé : vendredi 17 octobre 2008 10:47
>> À : Haoda Fu
>> Cc : R help
>> Objet : Re: [R] R plot
>>
>> Haoda Fu wrote:
>>     
>>> All -
>>>
>>>
>>> When I plot something like
>>>
>>> a<-rnorm(5)
>>> b<-rnorm(5)
>>> plot(a,b,col = "red")
>>> points(10,-10)
>>>
>>> The last point is missing because it is out of range of the first 
>>> plot.
>>>
>>> I just try to switch from Matlab to R. In Matlab, it always can 
>>> automatic adjust the xlim and ylim for such case.
>>>
>>> Is it possible auto adjust in R? Otherwise keep tracking xlim and ylim
>>> is really annoying.
>>>
>>>   
>>>       
>> if you know the range in advance, you can specify it using the xlim and
>> ylim
>> parameters to plot.  you can also use them in points (it doesn't cause
>> an
>> error), but it does not seem to have the desired effect of reshaping
>> the
>> plot.
>>
>> it's perhaps a pity it works this way, but you have to get used to it. 
>> or drop r if you find matlab better.
>>
>>
>> vQ
>>
>> ______________________________________________
>> 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.
>>
>> ______________________________________________
>> 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.
>>     
>
> --------------------------------------------------------------------
> E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
> Fax-to-email: +44 (0)870 094 0861
> Date: 17-Oct-08                                       Time: 10:31:03
> ------------------------------ XFMail ------------------------------
>
> ______________________________________________
> 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.
>   


-- 
-------------------------------------------------------------------------------
Wacek Kusnierczyk, MD PhD

Email: waku at idi.ntnu.no
Phone: +47 73591875, +47 72574609

Department of Computer and Information Science (IDI)
Faculty of Information Technology, Mathematics and Electrical Engineering (IME)
Norwegian University of Science and Technology (NTNU)
Sem Saelands vei 7, 7491 Trondheim, Norway
Room itv303

Bioinformatics & Gene Regulation Group
Department of Cancer Research and Molecular Medicine (IKM)
Faculty of Medicine (DMF)
Norwegian University of Science and Technology (NTNU)
Laboratory Center, Erling Skjalgsons gt. 1, 7030 Trondheim, Norway
Room 231.05.060



More information about the R-help mailing list