ggthemes
#library("devtools")
#install_github("jrnold/ggthemes")
library("ggplot2")
##
## Attaching package: 'ggplot2'
##
## The following object is masked _by_ '.GlobalEnv':
##
## presidential
library("ggthemes")
dsamp <- diamonds[sample(nrow(diamonds), 1000), ]
(ggplot(mtcars, aes(wt, mpg))
+ geom_point() + geom_rangeframe()
+ theme_tufte())

#The Tufte minimal boxplot.
(ggplot(mtcars, aes(factor(cyl), mpg))
+ theme_tufte(ticks=FALSE)
+ geom_tufteboxplot())

#Economist theme
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_economist()
+ scale_colour_economist()
+ ggtitle("Diamonds Are Forever"))

#Solarized theme
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_solarized()
+ scale_colour_solarized("blue"))

#The dark theme.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_solarized(light=FALSE)
+ scale_colour_solarized("red"))

#An alternative theme.
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_solarized_2()
+ scale_colour_solarized("blue"))

#Stata theme
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_stata()
+ scale_colour_stata()
+ ggtitle("Plot Title"))

#Excel 2003 theme
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_excel()
+ scale_colour_excel())

(ggplot(diamonds, aes(clarity, fill=cut))
+ geom_bar()
+ scale_fill_excel()
+ theme_excel())

#Inverse Gray Theme
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_igray())

#Fivethirtyeight theme
(qplot(hp, mpg, data= subset(mtcars, cyl != 5), geom="point", color = factor(cyl))
+ geom_smooth(method = "lm", se = FALSE)
+ scale_color_fivethirtyeight()
+ theme_fivethirtyeight())

#Tableau Scales
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_igray()
+ scale_colour_tableau())

(qplot(carat, price, data=dsamp, colour=cut)
+ theme_igray()
+ scale_colour_tableau("colorblind10"))

#Stephen Few's Practical Rules for Using Color
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_few()
+ scale_colour_few())

#Wall Street Journal
(qplot(carat, price, data=dsamp, colour=cut)
+ theme_wsj()
+ scale_colour_wsj("colors6", "")
+ ggtitle("Diamond Prices"))

#GDocs Theme
(qplot(carat, price, data=dsamp, colour=clarity)
+ theme_gdocs()
+ ggtitle("Diamonds")
+ scale_color_gdocs())

#Calc Theme
(qplot(carat, price, data=dsamp, colour=clarity)
+ theme_calc()
+ ggtitle("Diamonds")
+ scale_color_calc())

#Pander Theme
(qplot(carat, price, data = dsamp, colour = clarity)
+ theme_pander()
+ scale_colour_pander())
## Loading required package: pander

(ggplot(dsamp, aes(clarity, fill = cut)) + geom_bar()
+ theme_pander()
+ scale_fill_pander())

#Highcharts theme
(qplot(carat, price, data = dsamp, colour = cut)
+ theme_hc()
+ scale_colour_hc()
+ ggtitle("Diamonds Are Forever"))

(qplot(carat, price, data = dsamp, colour = cut)
+ theme_hc(bgcolor = "darkunica")
+ scale_colour_hc("darkunica")
+ ggtitle("Diamonds Are Forever"))

#---------------------
dtemp <- data.frame(months = factor(rep(substr(month.name,1,3), 4), levels = substr(month.name,1,3)),
city = rep(c("Tokyo", "New York", "Berlin", "London"), each = 12),
temp = c(7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6,
-0.2, 0.8, 5.7, 11.3, 17.0, 22.0, 24.8, 24.1, 20.1, 14.1, 8.6, 2.5,
-0.9, 0.6, 3.5, 8.4, 13.5, 17.0, 18.6, 17.9, 14.3, 9.0, 3.9, 1.0,
3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8))
dtemp
## months city temp
## 1 Jan Tokyo 7.0
## 2 Feb Tokyo 6.9
## 3 Mar Tokyo 9.5
## 4 Apr Tokyo 14.5
## 5 May Tokyo 18.2
## 6 Jun Tokyo 21.5
## 7 Jul Tokyo 25.2
## 8 Aug Tokyo 26.5
## 9 Sep Tokyo 23.3
## 10 Oct Tokyo 18.3
## 11 Nov Tokyo 13.9
## 12 Dec Tokyo 9.6
## 13 Jan New York -0.2
## 14 Feb New York 0.8
## 15 Mar New York 5.7
## 16 Apr New York 11.3
## 17 May New York 17.0
## 18 Jun New York 22.0
## 19 Jul New York 24.8
## 20 Aug New York 24.1
## 21 Sep New York 20.1
## 22 Oct New York 14.1
## 23 Nov New York 8.6
## 24 Dec New York 2.5
## 25 Jan Berlin -0.9
## 26 Feb Berlin 0.6
## 27 Mar Berlin 3.5
## 28 Apr Berlin 8.4
## 29 May Berlin 13.5
## 30 Jun Berlin 17.0
## 31 Jul Berlin 18.6
## 32 Aug Berlin 17.9
## 33 Sep Berlin 14.3
## 34 Oct Berlin 9.0
## 35 Nov Berlin 3.9
## 36 Dec Berlin 1.0
## 37 Jan London 3.9
## 38 Feb London 4.2
## 39 Mar London 5.7
## 40 Apr London 8.5
## 41 May London 11.9
## 42 Jun London 15.2
## 43 Jul London 17.0
## 44 Aug London 16.6
## 45 Sep London 14.2
## 46 Oct London 10.3
## 47 Nov London 6.6
## 48 Dec London 4.8
qplot(months, temp, data=dtemp, group=city, color=city, geom="line") +
geom_point(size=1.5) +
ggtitle("Monthly Average Temperature") +
theme_hc() +
scale_colour_hc()

qplot(months, temp, data=dtemp, group=city, color=city, geom="line") +
geom_point(size=1.1) +
ggtitle("Monthly Average Temperature") +
theme_hc(bgcolor = "darkunica") +
scale_fill_hc("darkunica")
