[R] Re: x axis point labels

Michaell Taylor
Mon, 24 Sep 2001 21:12:51 -0000

Sorry,

I hit the send button and then immediately saw the axes=FALSE and manual axis
commands.

Problem solved.

Michaell

On Monday 24 September 2001 16:58, Michaell Taylor
wrote:
> 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