Re: [R] how to paste a vector to expression?

2010-08-18 Thread Gavin Simpson
On Tue, 2010-08-17 at 13:49 -0700, Kay Cichini wrote:
 ..thank you!
 
 this generally works well - but after saving the result as jpeg i noticed
 that the printed = used with the expression looks different from the =
 signs used for the same graph for another simple text annotation (i.e. the
 linewidths used with the expression are much smaller). maybe there is still
 another solution? - really no way  using the paste command? curiously
 paste(expression(bar(x)),=,dat) does not work..

It's drawn in a different font; probably because many of the glyphs you
can produce with plotmath don't exist in the fonts used for plain text
(but I am guessing).

Why can't you do all the labels using expression() if this bothers you
so?

plot(1:10, main = expression(bar(x) == dat),
 ylab = expression(foo == bar),
 xlab = expression(something else == the~other))

Apologies if this has already been discussed/dismissed. I don't see the
rest of the thread in your message and I've been away from my email for
several weeks and didn't follow the list closely during that period.

HTH

G

 
 thanks,
 kay

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 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.


Re: [R] how to paste a vector to expression?

2010-08-18 Thread Kay Cichini

..of course that works, too.

thanks a lot,
kay



Zitat von Gavin Simpson [via R]  
ml-node+2329504-916404301-40...@n4.nabble.com:




 On Tue, 2010-08-17 at 13:49 -0700, Kay Cichini wrote:
 ..thank you!

 this generally works well - but after saving the result as jpeg i noticed
 that the printed = used with the expression looks different from the =
 signs used for the same graph for another simple text annotation (i.e. the
 linewidths used with the expression are much smaller). maybe there is still
 another solution? - really no way  using the paste command? curiously
 paste(expression(bar(x)),=,dat) does not work..

 It's drawn in a different font; probably because many of the glyphs you
 can produce with plotmath don't exist in the fonts used for plain text
 (but I am guessing).

 Why can't you do all the labels using expression() if this bothers you
 so?

 plot(1:10, main = expression(bar(x) == dat),
  ylab = expression(foo == bar),
  xlab = expression(something else == the~other))

 Apologies if this has already been discussed/dismissed. I don't see the
 rest of the thread in your message and I've been away from my email for
 several weeks and didn't follow the list closely during that period.

 HTH

 G


 thanks,
 kay

 --
 %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  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.


 __
 View message @  
 http://r.789695.n4.nabble.com/how-to-paste-a-vector-to-expression-tp2328564p2329504.html

 To unsubscribe from Re: how to paste a vector to expression?, click  
 http://r.789695.n4.nabble.com/template/NodeServlet.jtp?tpl=unsubscribe_by_codenode=2329011code=S2F5LkNpY2hpbmlAdWliay5hYy5hdHwyMzI5MDExfC0yMTExMTEwMTQ4






-

Kay Cichini
Postgraduate student
Institute of Botany
Univ. of Innsbruck


-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-paste-a-vector-to-expression-tp2328564p2329547.html
Sent from the R help mailing list archive at Nabble.com.

[[alternative HTML version deleted]]

__
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.


Re: [R] how to paste a vector to expression?

2010-08-17 Thread David Winsemius


On Aug 17, 2010, at 11:51 AM, Kay Cichini wrote:



hello,

i need to annotate a plot with an expression and a variable value -  
like:


plot(1:4)
dat-1:2
text(2:3,2:3,expression(paste(bar(x)==dat)))


... but with the dat values plotted, 1 at x=2,y=2, and 2 at x=3,y=3.


One way ... actually the first success after several earlier failed  
efforts that I thought should have worked :


plot(1:4)
dat-1:2
text(2:3,2:3,labels=sapply(dat,
   function(x) as.expression(substitute(list(bar(x) == x),  
list(x=x) )) ))


--

David Winsemius, MD
West Hartford, CT

__
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.


Re: [R] how to paste a vector to expression?

2010-08-17 Thread Kay Cichini

..thank you!

this generally works well - but after saving the result as jpeg i noticed
that the printed = used with the expression looks different from the =
signs used for the same graph for another simple text annotation (i.e. the
linewidths used with the expression are much smaller). maybe there is still
another solution? - really no way  using the paste command? curiously
paste(expression(bar(x)),=,dat) does not work..

thanks,
kay


-

Kay Cichini
Postgraduate student
Institute of Botany
Univ. of Innsbruck


-- 
View this message in context: 
http://r.789695.n4.nabble.com/how-to-paste-a-vector-to-expression-tp2328564p2329011.html
Sent from the R help mailing list archive at Nabble.com.

__
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.