Skip to content

greek letters and deparsing in title

4 messages · Ramon Diaz-Uriarte, Thomas Lumley, Stephen R. Laniel +1 more

#
Dear All,

In the title of a plot, I would like to mix greek letters with numbers, where
the numbers are obtained from a particular function to a vector (e.g., max(x));
in each call, the value of this vector can change.

Without greek symbols I use something like:
title(sub=paste("x1=", deparse(x[1]),"beta = ",deparse(max(x)), "rho = ",
deparse(min(x)))) 

but I'd like beta and rho to show up as greek letters.

I have tried several combinations of "expression", "paste", "plain", and looked
at the help for legend, text, and title, but I am not able to get it to work.

Thank you,

Ramon
--
Ramon Diaz-Uriarte
Dept. Zoology and Statistics
University of Wisconsin-Madison
Madison, WI 53706

email: rdiazuri at students.wisc.edu
phone: 608-238-8041
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
#
On Sat, 23 Oct 1999, ramon diaz-uriarte wrote:

            
Try eg
R> x<-rnorm(100)
R> plot(x,main=substitute(beta==t,list(t=max(x))))


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
1 day later
#
Hello,

I'm trying to write a command that places the legend for a graph wherever
I click the mouse.  So I tried

legend( locator(1), c("label 1", "label 2", "label 3"), lty=c(1,2,0),
pch=c("  C"))

I ran the command, and it paused until it received a mouseclick.  But when
I clicked well within the graphics window, I got this:

``Error: non-numeric coordinates"

Any idea why I'd get that?  I clicked on a valid part of the graphics
window.  I'm clearly missing something, but I'm not sure what.  I've
attached the full list of commands for this particular script, just in
case the secret lies therein.

Thanks for any help anyone can provide.

--Steve

Stephen R. Laniel            |    "I've got a match:
Carnegie Mellon University   |     Your embrace and my collapse."
laniel at cmu.edu               |     --They Might Be Giants
-------------- next part --------------
# Regress d on latitude and latitude^2
logreg_lm( CMPGlog ~ Minprice + EngSize + EngRPM + FuelCap + Wheelbase
+ Weight + Domestic + Civic, data = cars )

# Coefficients from regression logreg
cf_logreg$coefficients

# Foreign non-Civic x values
xf_seq( min( cars[cars$Domestic==0 & cars$Civic==0, "Weight"] ),
max( cars[cars$Domestic==0 & cars$Civic==0, "Weight"] ), len=100 )

# Domestic x values
xd_seq( min( cars[ cars$Domestic==1, "Weight" ] ),
max( cars[ cars$Domestic==1, "Weight" ] ), len=100 )

# Predicted y values for foreign non-Civic cars
# Here Civic = 0 and Domestic = 0, so we include no terms for
# those variables
yf_(
exp( cf[1]
+ ( cf[2] * median(cars$Minprice) )
+ ( cf[3] * median(cars$EngSize) )
+ ( cf[4] * median(cars$EngRPM) )
+ ( cf[5] * median(cars$FuelCap) )
+ ( cf[6] * median(cars$Wheelbase) )
+ ( cf[7] * xf ) ) )

# Predicted y values for domestic cars
# Here Civic = 0 and Domestic = 1, so there is no term for the
# Civic variable
yd_(
exp(  (cf[1] + cf[8])
+ ( cf[2] * median(cars$Minprice) )
+ ( cf[3] * median(cars$EngSize) )
+ ( cf[4] * median(cars$EngRPM) )
+ ( cf[5] * median(cars$FuelCap) )
+ ( cf[6] * median(cars$Wheelbase) )
+ ( cf[7] * xd ) ) )

# x- and y-coordinates for the cars plot -- here the x-coordinate
# is the Civic's Weight, and the y-coordinate is its CMPGlog

cx_cars[cars$Model=="Civic","Weight"]
cy_cars[cars$Model=="Civic","CMPGlog"]

plot( range(xd, xf, cx), range(yd, yf, cy), type="n" )
lines( xf, yf, lty=1)
lines( xd, yd, lty=2)
points( cx, cy, pch="C" )
abline( v=quantile( cars[cars$Domestic==0 & cars$Civic==0, "Weight"],
c(0.1, 0.9) ), lty=1)

# 10th and 90th percentiles for 
abline( v=quantile( cars[cars$Domestic==1, "Weight"],
c(0.1, 0.9) ), lty=2)
legend( locator(1), c("label 1", "label 2", "label 3"), lty=c(1,2,0),
pch=c("  C"))
#
"Stephen R. Laniel" <laniel at cmu.edu> writes:
It is taking your labels for the y coordinate, try legend=c(etc...)