What is the most elegant way to split data and produce seasonal boxplots?

前端 未结 3 1020
无人及你
无人及你 2021-01-12 17:40

I want to produce seasonal boxplots for a lot of different time series. I hope that the code below clearly illustrates what I want to do.

My question is now, how to

3条回答
  •  执笔经年
    2021-01-12 18:23

    Using 'ggplot2' (and @James' month names, thanks!):

    DF$month <- factor(strftime(DF$Time,"%b"),levels=month.abb)
    ggplot(DF, aes(x=,month, y=Data)) +
        geom_boxplot()
    

    boxplot

    (BTW: note that in 'ggplot2' "The upper and lower "hinges" correspond to the first and third quartiles (the 25th and 7th percentiles). This differs slightly from the method used by the boxplot function, and may be apparent with small samples." - see documentation)

提交回复
热议问题