On Wed, 2009-08-19 at 14:20 +0100, e-letter wrote: > On 18/08/2009, Gavin Simpson <gavin.simp...@ucl.ac.uk> wrote: > > On Tue, 2009-08-18 at 13:06 +0100, e-letter wrote: > >> On 17/08/2009, Michael Knudsen <micknud...@gmail.com> wrote: > >> > On Mon, Aug 17, 2009 at 12:51 PM, e-letter <inp...@gmail.com> wrote: > >> > > >> >> I have tried to add the delta (δ) symbol to the y axis label and the > >> >> result is &D, using the command: > >> >> > >> >> ...ylab="δt"... > >> > > >> > Try ylab = expression(delta*t) instead. > >> > > >> This does not work, the result is > >> expression(delta*t) > > > > It works for the rest of us who suggested this. > > > > plot(1:10, ylab = expression(delta*t)) > > > True, but the following commands fails: > plot(1:10,ylab="temperature expression(delta*t)") > plot(1:10,ylab="temperature" expression(delta*t)) > Error: syntax error, unexpected SYMBOL, expecting ',' in > "plot(1:10,ylab="temperature" expression" > > So I want to be able to have 'δt' and 'temperature δt' as a y-axis label.
Ah, but you never said that. We aren't mind readers you know ;-) What you need is an expression that will, when used, give you a text label containing "Temperature δt". What you have done is create a character string of the literal "...expression(delta*t)" which is of course why it is printed as the label - after all , you asked R to do this. I suggest you read the plotmath help page, accessed via: ?plotmath executed at the prompt. I found this expression stuff complicated when I first started out, until I realised that whatever gets passed to expression(....) has to be a syntactically valid R command. So for your particular example we need: plot(1:10, ylab = expression(Temperature ~ delta*t)) Temperature is treated as the character string "Temperature"; the "~" means leave some space between the bits either side of "~"; delta is a special name that will get replaced by the relevant glyph; the "*" juxtaposes delta and "t", ie places them next to one another without any space in between. I see that Baptiste has also just replied with a similar solution to mine. Baptiste's solution quotes "temperature " with the spacing being stated explicitly. Whilst both yield similar results, using "~" and not having to quote things results in a simpler solution, IMHO. HTH Gavin > > ______________________________________________ > R-help@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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ______________________________________________ R-help@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.