[R] labeling abscissa using a function of the plotted scale

Jim Lemon jim at bitwrit.com.au
Thu Oct 24 07:51:42 CEST 2013


On 10/24/2013 01:49 PM, Hurr wrote:
> Sorry, I wasn't aware that it was that difficult.
> Here is the example scatter plot data:
> xvalue,yvalue
> 1,9
> 2,3
> 3,4
> 4,7
> 5,2
> 6,5
> 7,3
> 8,6
> Please show me how to label the x axis with 1/xvalue.
> Hopefully, R plotter takes care of spacing, but maybe not.

Hi Hurr,
how about:

xvalue<-1:8
yvalue<-c(9,3,4,7,2,5,3,6)
plot(xvalue,yvalue,xaxt="n")
axis(1,at=xvalue,labels=round(1/xvalue,2))

Jim



More information about the R-help mailing list