[R] Displaying "<=" in axis values

David Winsemius dwinsemius at comcast.net
Tue Apr 15 19:02:14 CEST 2014


On Apr 15, 2014, at 9:19 AM, Boris Steipe wrote:

> The following works for me:
> 
> x <- rnorm(10)
> plot(x, xaxt="n")
> axis(side=1, at=axTicks(1),lab=c("≤ a","≥ b","≈ c","≠ d","= e"))
> 
> (In case the characters get mangled in transition:
> I have used le, ge, approx. equal, ne, and equal in this example)

I thought the suggestion to use axTicks() was an excellent one. This would generalize it to the construction of the labels argument:

     ..., lab=sapply( paste("≤", axTicks(1)), as.expression)    0

-- 
David.
> 
> Cheer,s
> B.
> 
> 
> 
> On 2014-04-15, at 11:58 AM, Dennis Fisher wrote:
> 
>> R 3.0.2
>> OS X
>> 
>> Colleagues
>> 
>> In a graphic, the x-axis values
>> 	2, 4, 6, 8, 10, 12
>> 
>> I would like to present these as:
>> 	≤ 2, ≤ 4, ≤ 6, ≤8, ≤ 10, ≤ 12
>> 
>> I have tried to accomplish this with 
>> 	expression 
>> and 
>> 	bquote 
>> without success.  Can someone provide the appropriate code?  
>> 
>> Thanks.



David Winsemius
Alameda, CA, USA




More information about the R-help mailing list