[R] add data symbol to axis label

Jim Lemon jim at bitwrit.com.au
Sat Feb 9 07:52:05 CET 2013


On 02/08/2013 10:53 PM, e-letter wrote:
> Readers,
>
> Is it possible to add a data symbol (e.g. pch='21') to an axis label?
> The objective is to plot a graph with two (2) y-axes and the plotting
> character for data set 1 is added to the label of y1 axis (left); plot
> character for data set 2 is added to label of y2 (right) axis.
>
Hi e-letter,
You can use escape codes in a string to insert symbols in an axis label 
like this:

plot(...,xlab="Male\u2642")

if you are in a Unicode locale. You will have to find out which escape 
codes work in your locale, if the symbols you wish to use exist in that 
locale and what their escape codes are.

Jim



More information about the R-help mailing list