3

I'd like to add a "greater than"-sign to an axis label. The text shown should be cumulated frequency p(>p[f]))

I tried (amongst others):

title(mgp=c(2.50, 1, 0), cex.lab=1.25, xlab = expression("cumulated frequency" ~ p(>p[f]))) # xlab

But none of my trials worked - where is the mistake? Without having the > it works fine:

title(mgp=c(2.50, 1, 0), cex.lab=1.25, xlab = expression("cumulated frequency" ~ p(p[f]))) # xlab
R_User
  • 10,682
  • 25
  • 79
  • 120

2 Answers2

2

> is a binary operator. Thus, it needs something on its left side. For example a "dummy"-null-label {}:

plot(1:10, 1:10, xlab=expression("frequency"~p({}>p[f])))

Also, e.g. phantom(), plain(), etc. may be used to print "nothing".

If you don't want spaces around <, try:

plot(1:10, 1:10, main=expression("test"~p(paste(">",p[f]))))

or for a more "mathematical" <:

plot(1:10, 1:10, main=expression("test"~p(paste(symbol(">"),p[f]))))
gagolews
  • 12,836
  • 2
  • 50
  • 75
  • Is there also a way to remove the spaces before and after the `>`-sign? With RichardScrivens solution I can do it, but the `>`-sign in the text-mode looks ugly. And in the plotmath-mode spaces are added,... – R_User Jun 06 '14 at 19:55
  • In your second solution is like the one of RichardScriven. The `>` is much larger than the the one in your first solution. Would be nice to have the small `>` without spaces,... :) – R_User Jun 06 '14 at 20:08
  • 1
    @R_User: What about `symbol(">")` - this gives a more "mathematical symbol"-like `>`? – gagolews Jun 06 '14 at 20:12
1

this might work for you:

plot.new()
title(mgp = c(2.50, 1, 0), cex.lab = 1.25, 
      xlab = expression(paste("cumulated frequency p(>", p[f], ")")))
Rich Scriven
  • 97,041
  • 11
  • 181
  • 245