[R] boxplot with x-axis time

MacQueen, Don macqueen1 at llnl.gov
Fri Mar 14 15:46:25 CET 2014


Something like:

tmp <- boxplot(V ~ date, data=pippo, plot=FALSE)

bxp(tmp, at=sort(unique(pippo$date))

You may need to adjust the x-axis limits and the box widths.

-Don

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/13/14 2:30 PM, "giuseppe calamita" <calamita_giuseppe at yahoo.it> wrote:

>Dear R-users,
>I want to plot boxplots of a single variable collected a few times during
>almost one year and I would like the x-axis to recognize the date-class
>of the variable.
>
>I found some topics in the archive but:
>- some questions were poorly posed
>(http://r.789695.n4.nabble.com/Boxplot-with-dates-td896401.html)  and so
>with no answer; 
>- others, only address the topic of have the date on the x-axes ordered
>(http://r.789695.n4.nabble.com/Using-boxplot-in-a-daily-time-series-td8430
>60.html#a843061);
>- finally, another topic
>(http://r.789695.n4.nabble.com/Boxplot-position-on-X-axis-relative-to-it-s
>-value-td2196020.html)is quite close to what I need but it is not exactly
>the same.
>
>I attached a simulated data.frame: it 2-column, the1-st are date and the
>2-nd is the variable.
>Here the code I use:
>
>pippo<- read.csv("pippo.csv")
>pippo$date<- as.Date(pippo$date, format="%Y-%m-%d")
>
>boxplot(V ~ date, data=pippo)
>
>I would like that the x-axis look like in this plot
>plot(V ~ date, data=pippo)
>where the thick reproduce the right time of the year .
>
>Thank you for your help




More information about the R-help mailing list