[R] Unwanted boxes in legend

Peter Ehlers ehlers at ucalgary.ca
Wed Apr 21 13:04:33 CEST 2010


On 2010-04-21 4:35, Peter Ehlers wrote:
> The 'border' argument was added in 2.1.10.

Egad! Did I really type that?
I meant 'in R 2.10.0'.

  -Peter Ehlers

>
>
> On 2010-04-21 1:53, Steve Murray wrote:
>>
>> Thanks Peter,
>>
>> I'm using version 2.8.0 (2008-10-20). This version should be recent
>> enough to pick up fundamentals such as this, right? I guess the
>> obvious thing to do is update and try again...
>>
>> Cheers,
>>
>> Steve
>>
>> ----------------------------------------
>>> Date: Tue, 20 Apr 2010 11:55:20 -0600
>>> From: ehlers at ucalgary.ca
>>> To: tgstewart at gmail.com
>>> CC: smurray444 at hotmail.com; r-help at r-project.org
>>> Subject: Re: [R] Unwanted boxes in legend
>>>
>>> On 2010-04-19 8:11, Thomas Stewart wrote:
>>>> Try border=c(0,0,1,0).
>>>> -tgs
>>>
>>> If the 'border' argument is not recognized, then this won't work.
>>>
>>> Steve:
>>> What version of R are you using? I have no problems with the
>>> suggestions I gave you in R 2.10.1 or R 2.11.0 alpha.
>>>
>>> -Peter Ehlers
>>>
>>>>
>>>> On Mon, Apr 19, 2010 at 4:21 AM, Steve Murraywrote:
>>>>
>>>>>
>>>>> Dear all,
>>>>>
>>>>> Thanks for the response, however I'm getting the following error
>>>>> message
>>>>> when I execute the legend command using the 'border' argument:
>>>>>
>>>>> Error in legend(10, par("usr")[4], c("A", "B", :
>>>>> unused argument(s) (border = FALSE)
>>>>>
>>>>>
>>>>> Is anyone aware of any alternative means of switching off boxes
>>>>> around all
>>>>> but one of the elements in a legend?
>>>>>
>>>>> Many thanks for any input,
>>>>>
>>>>> Steve
>>>>>
>>>>>
>>>>> ----------------------------------------
>>>>>> Date: Thu, 15 Apr 2010 12:13:40 -0600
>>>>>> From: ehlers at ucalgary.ca
>>>>>> To: smurray444 at hotmail.com
>>>>>> CC: r-help at r-project.org
>>>>>> Subject: Re: [R] Unwanted boxes in legend
>>>>>>
>>>>>> On 2010-04-15 11:10, Steve Murray wrote:
>>>>>>>
>>>>>>> Dear all,
>>>>>>>
>>>>>>> I am using the following code to generate a legend in my plot
>>>>> (consisting of both bars and points), but end up with boxes around my
>>>>> points:
>>>>>>>
>>>>>>> legend(10, par("usr")[4], c("A", "B", "C", "D"), fill=c(NA,NA,
>>>>>>> "grey28",
>>>>> NA), pch=c(16,4,NA,18), col=c("red","blue","grey28","yellow"),
>>>>> lty=FALSE,
>>>>> bty="n", horiz=FALSE)
>>>>>>>
>>>>>>> I want a box around the third element of the legend (to represent
>>>>>>> the
>>>>> bar 'fill' colour), but not for the others, where points are shown
>>>>> instead.
>>>>>>>
>>>>>>> What am I doing wrong above and how do I correct it?
>>>>>>
>>>>>> Add the 'border' argument:
>>>>>>
>>>>>> either
>>>>>>
>>>>>> border = FALSE # in which case no box is drawn for any element
>>>>>>
>>>>>> or
>>>>>>
>>>>>> border = c(NA, NA, "black", NA)
>>>>>>
>>>>>> -Peter Ehlers
>>>>>>
>>>>>>>
>>>>>>> Many thanks,
>>>>>>>
>>>>>>> Steve
>>>>>>>
>>>>>>>
>>>>>>> ______________________________________________
>>>>>>> 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.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Peter Ehlers
>>>>>> University of Calgary
>>>>>
>>>>>
>>>>> ______________________________________________
>>>>> 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.
>>>>>
>>>>
>>>
>>> --
>>> Peter Ehlers
>>> University of Calgary
>>
>> _________________________________________________________________
>> http://clk.atdmt.com/UKM/go/197222280/direct/01/
>> Do you have a story that started on Hotmail? Tell us now
>>
>

-- 
Peter Ehlers
University of Calgary



More information about the R-help mailing list