Created
September 20, 2014 17:51
-
-
Save hongo35/1ad54ce8cf217b62cda8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(ggplot2) | |
library(scales) | |
# データの読み込み | |
data <- read.csv("/path/to/activities.csv", header=T) | |
# 基本統計量 | |
summary(data$steps) | |
# グラフ(日ごとの推移) | |
graph <- ggplot(data, aes(x=as.Date(date), y=steps, fill=weekday)) + scale_fill_gradientn(colours=c('#ff4500', '#434348', '#434348', '#434348', '#434348', '#434348', '#87cefa')) + geom_bar(stat='identity') + scale_x_date(label = date_format("%m月%d日")) + theme_bw(base_family = "Osaka") + xlab("日時") + ylab("歩数") + ggtitle("歩数の時系列推移") | |
plot(graph) | |
# グラフ(曜日別) | |
graph <- ggplot(data, aes(x=as.character(weekday), y=steps)) + geom_boxplot() + theme_bw(base_family = "Osaka") + scale_x_discrete(labels=c('日','月','火','水','木','金','土')) + xlab("曜日") + ylab("歩数") | |
plot(graph) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment