[R] x axis point labels

Michaell Taylor michaell.taylor at reis.com
Mon Sep 24 22:58:13 CEST 2001


I am attempting to manually specify x axis value labels (NOT x axis label as 
in xlab) on a density plot.  Generally speaking, I would like to erase the 
default x axis point labels and replace them with arbitrary x axis point 
labels relating to specific CDF points.

I am sure this can be done, but it isn't obvious to me how.  Has anyone done 
this before?

My R code follows if it helps (new to R so please excuse any awkwardness that 
you notice.)

plot(density(gdp), main="Probability Distribution\n of 2002 US GDP 
Forecast",lwd=3, 
	xlim=c(-9,9), ylim=c(0,.3),xlab="Percent Real GDP Growth")
par(new=T)
newline _ cbind(c(gdp[5000/2],gdp[5000/2]),c(0,.25)) 
newline1 _ cbind(c(gdp[.05*5000],gdp[.05*5000]),c(0,.15)) 
newline2 _ cbind(c(gdp[.95*5000],gdp[.95*5000]),c(0,.15)) 
newline3 _ cbind(c(gdp[.99*5000],gdp[.99*5000]),c(0,.1)) 
newline4 _ cbind(c(gdp[.01*5000],gdp[.01*5000]),c(0,.1)) 
lines(newline, lwd=2)
lines(newline1)
lines(newline2)
lines(newline3)
lines(newline4)
text(gdp[5000/2],.29,"Median\nForecast")
text(gdp[5000*.05],.19,"0.05 Prob.\nForecast")
text(gdp[5000*.95],.24,"0.95 Prob.\nForecast")
text(gdp[5000*.99],.14,"0.99 Prob.\nForecast")
text(gdp[5000*.01],.14,"0.01 Prob.\nForecast")


===========================

Michaell Taylor, PhD

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



More information about the R-help mailing list