[R] Add interpunct (dot) symbol to axis label?

Uwe Ligges ligges at statistik.tu-dortmund.de
Thu Aug 9 18:20:16 CEST 2012



On 09.08.2012 18:05, Duncan Murdoch wrote:
> On 09/08/2012 11:52 AM, Uwe Ligges wrote:
>>
>> On 09.08.2012 13:56, Duncan Murdoch wrote:
>> > On 12-08-08 9:21 PM, Hillary Ward wrote:
>> >> I'm having problems creating an axis label for a plot.
>> >>
>> >> y_label = expression(paste(plain('CPUE
>> >> '),plain('(fish'),plain('x'),plain('h'^{-1}),plain(')')))
>> >>
>> >> I'd like to replace the "x" with an interpunct symbol (dot). Any
>> >> suggestions how to do this?
>> >
>> > The interpunct symbol is \u00b7 in Unicode.  You could try that, i.e.
>> >
>> > y_label = expression(paste(plain('CPUE
>> > '),plain('(fish'),plain('\u00b7'),plain('h'^{-1}),plain(')')))
>> >
>> > It might not work if your graphics device doesn't support Unicode.
>>
>> As I explained yesterday in another mail with that question (so
>> apparently it is a homework problem we should not answer at all), one
>> could use the UTF-8 encoded version by
>>
>>    options("OutDec"="\xB7")
>>
>> and just start the plotting ...
>
> Yes, I saw your message, which is how I knew the symbol exists.  But I
> think the question is different:  this one isn't being used as a decimal
> point, just a dot in a formula.


Oh, sorry, should read more carefully:

Several years ago I added %.% to the plotmath syntax symbols for that 
reason, see ?plotmath, hence:

plot(1, main = expression(CPUE(fish %.% h^{-1})))

seems to do the right thing.

Best,
Uwe









>
> Duncan Murdoch
>



More information about the R-help mailing list