When ploting a timeseries, the months are shown with abbreviation in the current language of the system. For example, x <- seq(from=as.Date("2000-04-01"), length.out=100, by=1) y <- rnorm(length(x), 5,2) plot(x, y) Show for me "avi mai jui jul" as I use R with French language localization. I see in the Windows FAQ how to completely change the language of R, but I search rather a way to change it for just the next command (also I run R in MacOS !). The solution will be to make myself the axis... except if someone has the trick to do it more easily. To generate the axis myself, it is not so simply to get one tick by month. I try axTicks(1) but it gives 5 ticks rather than 4 and > as.Date(axTicks(1), "1970-01-01") [1] "2000-04-13" "2000-05-03" "2000-05-23" "2000-06-12" "2000-07-02" Is not what I expected. Plot with date object seems to use a special way to generate ticks. Thanks a lot Marc -- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot
Hello, ?Sys.setlocale HTH, Pascal Le 15/01/2013 15:28, Marc Girondot a ?crit :> When ploting a timeseries, the months are shown with abbreviation in the > current language of the system. > For example, > x <- seq(from=as.Date("2000-04-01"), length.out=100, by=1) > y <- rnorm(length(x), 5,2) > plot(x, y) > > Show for me "avi mai jui jul" as I use R with French language localization. > > I see in the Windows FAQ how to completely change the language of R, but > I search rather a way to change it for just the next command (also I run > R in MacOS !). > > The solution will be to make myself the axis... except if someone has > the trick to do it more easily. > > To generate the axis myself, it is not so simply to get one tick by > month. I try > axTicks(1) but it gives 5 ticks rather than 4 > > and > > > as.Date(axTicks(1), "1970-01-01") > [1] "2000-04-13" "2000-05-03" "2000-05-23" "2000-06-12" "2000-07-02" > Is not what I expected. Plot with date object seems to use a special way > to generate ticks. > > Thanks a lot > > Marc > >
It works perfectly: > Sys.setlocale(category = "LC_TIME", locale="en_GB.UTF-8") [1] "en_GB.UTF-8" > x <- seq(from=as.Date("2000-04-01"), length.out=100, by=1) > y <- rnorm(length(x), 5,2) > plot(x, y) > Sys.setlocale(category = "LC_TIME", locale="") [1] "fr_FR.UTF-8" Thanks a lot Marc (I post the solution on the list as I have had some difficulties to find the good format for locale parameter. It could help others) Le 15/01/13 07:41, Pascal Oettli a ?crit :> Hello, > > ?Sys.setlocale > > HTH, > Pascal > > Le 15/01/2013 15:28, Marc Girondot a ?crit : >> When ploting a timeseries, the months are shown with abbreviation in the >> current language of the system. >> For example, >> x <- seq(from=as.Date("2000-04-01"), length.out=100, by=1) >> y <- rnorm(length(x), 5,2) >> plot(x, y) >> >> Show for me "avi mai jui jul" as I use R with French language >> localization. >> >> I see in the Windows FAQ how to completely change the language of R, but >> I search rather a way to change it for just the next command (also I run >> R in MacOS !). >> >> The solution will be to make myself the axis... except if someone has >> the trick to do it more easily. >> >> To generate the axis myself, it is not so simply to get one tick by >> month. I try >> axTicks(1) but it gives 5 ticks rather than 4 >> >> and >> >> > as.Date(axTicks(1), "1970-01-01") >> [1] "2000-04-13" "2000-05-03" "2000-05-23" "2000-06-12" "2000-07-02" >> Is not what I expected. Plot with date object seems to use a special way >> to generate ticks. >> >> Thanks a lot >> >> Marc >> >> >-- __________________________________________________________ Marc Girondot, Pr Laboratoire Ecologie, Syst?matique et Evolution Equipe de Conservation des Populations et des Communaut?s CNRS, AgroParisTech et Universit? Paris-Sud 11 , UMR 8079 B?timent 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.girondot at u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot