[R] Help with scatterplots in R

Petr PIKAL petr.pikal at precheza.cz
Fri Jul 30 07:58:19 CEST 2010


Hi

r-help-bounces at r-project.org napsal dne 29.07.2010 18:13:57:

> Hi John,
> 
> yes, you are right. Here is what I have done:
> 
> plot(DateJonEnd1, End1Jon,
>    main="Weekly Training at Endurance 1", xlim=c(13700,14750), 
xlab="Date",
>    ylim=c(0,350), ylab="Volume at Endurance 1", type="b", las=1)
> 
> Where DateJonEnd1 is the date of weekly Training, classified as "date" 
and in 
> the format 2010-07-28. I have the data from 2007-05-01 to 2010-03-31.
> 
> End1Jon is a numerical value, as an indicator of the volume of a 
particular 
> type of training per week. When I plot a years worth of data, R 
automatically 
> plots the months on the x-axis, however, as soon as the data spans more 
than a
> year R only gives me the years on the x-axis. However to compare the 
graphs, I
> would prefer to have the months on the x-axis, as well as the year.
> I have attached one of the graphs as an example.

Make your plot without axes by

plot(...., axes=FALSE, ...)
or
plot(...., xaxt="n", ...)

and than see

?axis.POSIXct   how to fine tune date axis with format option

Regards
Petr

> 
> Hope this makes it a bit clearer.
> Sarah
> 
> ________________________________________
> From: John Kane [jrkrideau at yahoo.ca]
> Sent: 28 July 2010 12:48
> To: r-help at r-project.org; Sarah Chisholm
> Subject: Re: [R] Help with scatterplots in R
> 
> I think that we need an example of what you are doing before anyone can 
really
> answer that question.
> 
> At the moment we don't even know how you are plotting the scatterplot.
> 
> --- On Wed, 7/28/10, Sarah Chisholm <sarah.chisholm.09 at ucl.ac.uk> wrote:
> 
> > From: Sarah Chisholm <sarah.chisholm.09 at ucl.ac.uk>
> > Subject: [R] Help with scatterplots in R
> > To: "r-help at r-project.org" <r-help at r-project.org>
> > Received: Wednesday, July 28, 2010, 6:57 AM
> > Hi,
> >
> > When I plot a scatter plot, R automatically only gives the
> > years on the x-axis. How can I make R also show the months
> > on the x-axis?
> >
> > Thank you very much!
> >
> >     [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org
> > mailing list
> > 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.
> >
> ______________________________________________
> R-help at r-project.org mailing list
> 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.



More information about the R-help mailing list