Changing Index Labelling on x axis

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Changing Index Labelling on x axis

WRAY NICHOLAS
Hi  I have a vector of data (for example c(2,3,4,5,4,3,2)

data<-c(2,3,4,5,4,3,2)
plot(data)

I simply want to up the index values along the x axis by 2, so that instead of
1, I have 3, instead of 2 I have 4 etc etc.  Despite ages playing around with
the axis function I can't get it to work, and keep getting weird error messages.
 This is likely to be laughably simple but if someone can help me out I'd be
grateful

Thanks Nick W
        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: Changing Index Labelling on x axis

Ivan Calandra-4
Hi Nick,

If I understand you correctly, that should do it:
plot(x=seq_along(data)+2, y=data)

HTH,
Ivan

--
Ivan Calandra, PhD
Scientific Mediator
University of Reims Champagne-Ardenne
GEGENAA - EA 3795
CREA - 2 esplanade Roland Garros
51100 Reims, France
+33(0)3 26 77 36 89
[hidden email]
--
https://www.researchgate.net/profile/Ivan_Calandra
https://publons.com/author/705639/

Le 22/07/2016 à 10:47, WRAY NICHOLAS a écrit :

> Hi  I have a vector of data (for example c(2,3,4,5,4,3,2)
>
> data<-c(2,3,4,5,4,3,2)
> plot(data)
>
> I simply want to up the index values along the x axis by 2, so that instead of
> 1, I have 3, instead of 2 I have 4 etc etc.  Despite ages playing around with
> the axis function I can't get it to work, and keep getting weird error messages.
>   This is likely to be laughably simple but if someone can help me out I'd be
> grateful
>
> Thanks Nick W
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.