Skip to content

Commit bef5991

Browse files
committed
update css, minor plot fix elsewhere
1 parent a96712d commit bef5991

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+3526
-5639
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ _bookdown_files/
77
*cache*
88
data/
99
*.log
10-
*delete
10+
*delete
11+
.DS_Store

04_diagnostics.Rmd

+4-4
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ test = with(test0, data.frame(lag, acf))
9898
ggplot(data = test, mapping = aes(x = lag, y = acf)) +
9999
geom_hline(aes(yintercept = 0), col='gray90') +
100100
geom_segment(mapping = aes(xend = lag, yend = 0), col='#ff5500', lwd=1.5) +
101-
geom_point(mapping = aes(x = lag, y=acf), col=palettes$orange$complementary, size=5) +
101+
geom_point(mapping = aes(x = lag, y=acf), col=palettes$orange$complementary[2], size=5) +
102102
labs(x='Lag', y='Autocorrelation') +
103103
lazerhawk::theme_trueMinimal() +
104104
theme(axis.title.x=element_text(color='gray25', size=15),
@@ -118,7 +118,7 @@ test = with(test0, data.frame(lag, acf))
118118
ggplot(data = test, mapping = aes(x = lag, y = acf)) +
119119
geom_hline(aes(yintercept = 0), col='gray90') +
120120
geom_segment(mapping = aes(xend = lag, yend = 0), col='#ff5500', lwd=1.5, show.legend=F) +
121-
geom_point(mapping = aes(x = lag, y=acf), col=palettes$orange$complementary, size=5, show.legend=F) +
121+
geom_point(mapping = aes(x = lag, y=acf), col=palettes$orange$complementary[2], size=5, show.legend=F) +
122122
labs(x='Lag', y='Autocorrelation') +
123123
lazerhawk::theme_trueMinimal() +
124124
theme(axis.title.x=element_text(color='gray25', size=15),
@@ -202,7 +202,7 @@ prop.table(table(min_rep>sort(y)[3]))
202202
# dev.off()
203203
ggplot(aes(x=min_rep), data=data_frame(min_rep=min_rep)) +
204204
geom_density(fill=scales::alpha('#ff5500', .5), color='transparent') +
205-
geom_line(color=palettes$orange$complementary, stat='density') +
205+
geom_line(color=palettes$orange$complementary[2], stat='density') +
206206
geom_vline(xintercept=min_y, color='gray50', alpha=.75) +
207207
lazerhawk::theme_trueMinimal() +
208208
theme(axis.title.x=element_text(color='gray25', size=15),
@@ -220,7 +220,7 @@ q10_rep = bayesplot::ppc_stat(y, t(yRep), stat=q10)$data
220220
221221
ggplot(aes(x=value), data=q10_rep) +
222222
geom_density(fill=scales::alpha('#ff5500', .5), color='transparent') +
223-
geom_line(color=palettes$orange$complementary, stat='density') +
223+
geom_line(color=palettes$orange$complementary[2], stat='density') +
224224
geom_vline(xintercept=quantile(y, .1), color='gray50', alpha=.75) +
225225
lazerhawk::theme_trueMinimal() +
226226
theme(axis.title.x=element_text(color='gray25', size=15),

06_issues.Rmd

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ diff(pbeta(c(.6, .9), 9, 3))
3838
```{r chooseBetaPrior2, echo=F, out.width='500px'}
3939
4040
ggplot(aes(x=x), data=data.frame(x=rbeta(10000, 9, 3))) +
41-
geom_line(stat='density', color=palettes$orange$complementary) +
41+
geom_line(stat='density', color=palettes$orange$complementary[2]) +
4242
geom_density(fill=scales::alpha('#ff5500', .75), color='transparent') +
4343
lazerhawk::theme_trueMinimal() +
4444
theme(axis.title.x=element_text(color='gray25'),

1001_Appendix.Rmd

+3-3
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ plotdat$nll = -plotdat$ll
161161
ggplot(aes(x=mu, y=sigma), data=plotdat) +
162162
geom_point(aes(), color='#ff5500', size=4, alpha=.25, show.legend=F, position = position_jitter(w = 0.2, h = 0.2)) +
163163
scale_size_continuous(range=c(.1,5)) +
164-
geom_point(aes(), col=palettes$orange$complementary, data=data.frame(t(coef(mlnorm))), size=10, alpha=.9) +
164+
geom_point(aes(), col=palettes$orange$complementary[2], data=data.frame(t(coef(mlnorm))), size=10, alpha=.9) +
165165
# geom_path(aes(), col='navy', alpha=.5) +
166166
labs(x=expression(mu), y=expression(sigma))+
167167
theme_trueMinimal() +
@@ -826,7 +826,7 @@ mass_vector = 1/vars
826826
```
827827

828828

829-
We are now ready to run the model. On my machine and with the above settings, it took about 45 seconds. Once complete we can use the <span class="pack">coda</span> package if desired as we have done before.
829+
We are now ready to run the model. On my machine and with the above settings, it took a couple seconds. Once complete we can use the <span class="pack">coda</span> package if desired as we have done before.
830830

831831
```{r HMCexampleRun, message=T, eval=FALSE}
832832
# Run the model
@@ -868,7 +868,7 @@ rstan::monitor(M1$sims,
868868
round(digit=3) %>%
869869
format(digit=3) %>%
870870
pander(justify='lrrrrrrr')
871-
glue::glue('log posterior = ', round(log_p_th(X, y, finalest),3))
871+
glue::glue('log posterior = ', {round(log_p_th(X, y, finalest),3)})
872872
```
873873

874874
Our estimates look pretty good, and inspection of the diagnostics would show good mixing and convergence as well. At this point we can compare it to the Stan output. For the following, I modified the previous Stan code to use the same inverse gamma prior and tweaked the control options for a little bit more similarity, but that's not necessary.

_bookdown.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
book_filename: "Bayesian-Basics"
2-
chapter_name: "Chapter "
3-
output_dir: "docs"
2+
language:
3+
ui:
4+
chapter_name: "Chapter "
5+
output_dir: "docs"
6+
delete_merged_file: true

_output.yml

+25-25
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
bookdown::epub_book:
2-
stylesheet: [css/book.css, css/standard_html.css]
31
bookdown::gitbook:
42
css: [css/standard_html.css]
5-
font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans|Alex+Brush
6-
font-family: 'Roboto'
7-
bookdown::tufte_html_book:
8-
css: [toc.css, ../css/tufte_bookdown/mytufte.css]
9-
font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans
3+
font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans|Stalemate|Alex+Brush
104
font-family: 'Roboto'
11-
config:
12-
toc:
13-
before: |
14-
<li><a href="./"><span style="font-size:150%; font-variant:small-caps; font-style:italic; color:#ff5500">Become a Bayesian with R</span></a></li>
15-
after: |
16-
<li><a href="https://m-clark.github.io" target="blank">Michael Clark</a></li>
17-
edit:
18-
link: https://github.com/rstudio/bookdown-demo/edit/master/%s
19-
highlight: pygments
20-
bookdown::html_book:
21-
css: [css/standard_html.css]
22-
font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans|Alex+Brush
23-
font-family: 'Roboto'
24-
bookdown::pdf_book:
25-
includes:
26-
in_header: preamble.tex
27-
latex_engine: xelatex
28-
citation_package: natbib
5+
bookdown::epub_book:
6+
stylesheet: [css/book.css, css/standard_html.css]
7+
# bookdown::tufte_html_book:
8+
# css: [toc.css, ../css/tufte_bookdown/mytufte.css]
9+
# font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans
10+
# font-family: 'Roboto'
11+
# config:
12+
# toc:
13+
# before: |
14+
# <li><a href="./"><span style="font-size:150%; font-variant:small-caps; font-style:italic; color:#ff5500">Become a Bayesian with R</span></a></li>
15+
# after: |
16+
# <li><a href="https://m-clark.github.io" target="blank">Michael Clark</a></li>
17+
# edit:
18+
# link: https://github.com/rstudio/bookdown-demo/edit/master/%s
19+
# highlight: pygments
20+
# bookdown::html_book:
21+
# css: [css/standard_html.css]
22+
# font-import: http://fonts.googleapis.com/css?family=Risque|Roboto|Open+Sans|Alex+Brush
23+
# font-family: 'Roboto'
24+
# bookdown::pdf_book:
25+
# includes:
26+
# in_header: preamble.tex
27+
# latex_engine: xelatex
28+
# citation_package: natbib

css/book.css

+137-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
@import url("http://fonts.googleapis.com/css?family=Roboto");
2-
@import url('https://fonts.googleapis.com/css?family=Source+Code+Pro');
1+
@import url("https://fonts.googleapis.com/css?family=Roboto");
32

43
.book {
54
background-color: #fffff8;
6-
color: red;
75
}
86

97
.section {
@@ -13,9 +11,9 @@
1311
.book .book-body .page-wrapper .page-inner section.normal {
1412
display: block;
1513
background-color: #fffff8;
16-
color: #595959;
14+
color: #585858;
1715
padding: 5px 15px;
18-
font-family: Roboto;
16+
font-family: Roboto, 'Helvetica Neue', sans-serif;
1917
word-wrap: break-word;
2018
overflow: hidden;
2119
line-height: 1.7;
@@ -25,6 +23,35 @@
2523
-moz-text-size-adjust: 100%;
2624
}
2725

26+
.book .book-body {
27+
background: #fffff8;
28+
-webkit-transition: left 250ms ease;
29+
-moz-transition: left 250ms ease;
30+
-o-transition: left 250ms ease;
31+
transition: left 250ms ease;
32+
}
33+
34+
/* link effects */
35+
.book .book-body .page-wrapper .page-inner section.normal a {
36+
color: #3D68FF;
37+
background-image: linear-gradient(180deg,transparent 90%, #FFD43D 0);
38+
background-size: 0 100%;
39+
background-repeat: no-repeat;
40+
text-decoration: none;
41+
-webkit-transition: background-size .4s ease;
42+
-moz-transition: background-size .4s ease;
43+
-ms-transition: background-size .4s ease;
44+
-o-transition: background-size .4s ease;
45+
transition: background-size .4s ease;
46+
border-bottom: 0px solid;
47+
}
48+
49+
.book .book-body .page-wrapper .page-inner section.normal a:hover {
50+
text-decoration: none;
51+
background-size: 100% 100%;
52+
cursor: pointer;
53+
}
54+
2855
.body-inner {
2956
background-color: #fffff8;
3057
}
@@ -43,7 +70,7 @@
4370

4471
.book .book-header {
4572
overflow: visible;
46-
height: 50px;
73+
height: 48px; /* adjust to match title space*/
4774
padding: 0 8px;
4875
z-index: 2;
4976
font-family: Roboto sans-serif;
@@ -53,31 +80,127 @@
5380
/* background: 0 0; */
5481
}
5582

56-
element .style {
83+
/* only way to set bgcolor of top bar?*/
84+
.book-body.fixed {
5785
background-color: #fffff8;
5886
}
5987

88+
/* Rather than resize the header, just get rid of line */
6089
.book.with-summary .book-header.fixed {
6190
background-color: #fffff8;
91+
/*font-family: Stalemate Roboto Sans; ignored as all it is doing is taking from index title*/
92+
border-bottom: 0 solid rgba(0,0,0,.07); /*just remove it; this makes height in .book-header above moot*/
93+
border-bottom-width: 0;
94+
border-bottom-style: solid;
95+
border-bottom-color: rgba(0, 0, 0, 0.07);
6296
}
6397

6498
i {
6599
background-color: #fffff8;
66100
}
67101

68-
.book .book-summary ul.summary li a:hover,
69-
.book .book-summary ul.summary li.active>a {
70-
color: #b2001d; /* color of current chapter/selection*/
102+
.book .book-summary {
103+
position: absolute;
104+
font-family: "Open Sans", 'Helvetica Neue', Roboto, sans-serif;
105+
top: 0;
106+
left: -300px;
107+
bottom: 0;
108+
z-index: 1;
109+
width: 300px;
110+
color: #364149; /**/
111+
background: #eaf5fb; /*#d9edf7#bdcadb #3572D9 #fafafa*/
112+
border-right: 1px solid rgba(0,0,0,.07);
113+
-webkit-transition: left 250ms ease;
114+
-moz-transition: left 250ms ease;
115+
-o-transition: left 250ms ease;
116+
transition: left 250ms ease;
117+
}
118+
119+
/* nav/menu area */
120+
.book .book-summary ul.summary li a, .book .book-summary ul.summary li span {
121+
display: block;
122+
padding: 10px 15px;
123+
border-bottom: none;
124+
color: #364149; /**/
125+
background: 0 0;
126+
text-overflow: ellipsis;
127+
overflow: hidden;
128+
white-space: nowrap;
129+
position: relative;
130+
}
131+
132+
133+
.book .book-summary ul.summary li a:hover, .book .book-summary ul.summary li.active>a {
134+
color: #fffff8; /*#6197D5*/
135+
background-color: #b2001d;
136+
}
137+
138+
/* so that before and after aren't treated the same as the toc, because why would they? */
139+
.book .book-summary ul.summary li.before a {
140+
color: #b2001d;
141+
text-decoration: none;
142+
font-size: 125%;
143+
font-variant: small-caps;
144+
font-family: 'Helvetica Neue', 'Open Sans', Roboto, sans-serif;
145+
font-weight: 800;
71146
}
72147

73148

74-
.book .book-summary ul.summary li a:focus {
75-
color: #ffffff; /* color of current chapter/selection*/
149+
.book .book-summary ul.summary li.before a:hover,
150+
.book .book-summary ul.summary li.before li.active>a {
151+
color: #fffff8; /*#6197D5*/
76152
background-color: #b2001d;
153+
text-decoration: none;
77154
}
78155

156+
.book .book-summary ul.summary li.after a, .book .book-summary ul.summary li.after a:hover {
157+
background-color: transparent;
158+
}
159+
160+
/* divider line for the title before and other stuff after toc */
161+
.book .book-summary ul.summary li.divider{
162+
height:1px;
163+
margin:7px 0;
164+
overflow:hidden;
165+
background:rgba(0,0,0,.07)
166+
}
167+
168+
.book .book-body .page-wrapper .page-inner section.normal pre {
169+
overflow: auto;
170+
word-wrap: normal;
171+
margin: 0 0 1.275em;
172+
padding: .85em 1em;
173+
background: #fafafa;
174+
}
175+
176+
79177
.book .book-body .page-wrapper .page-inner section.normal code,
80178
.book .book-body .page-wrapper .page-inner section.normal pre {
81-
background-color: #fffff8;
82-
font-family: 'Source Code Pro', 'Roboto Mono';
179+
font-family: 'Roboto Mono', Monaco, Consolas, "Liberation Mono", Menlo, 'Courier New', monospace;
180+
direction: ltr;
181+
border: none;
182+
color: inherit;
183+
}
184+
185+
.book .book-body .page-wrapper .page-inner section.normal .note {
186+
background-color: #fafafa;
187+
/*background-image: url('../img/R.ico');*/
188+
font-size: 80% ;
189+
margin: auto;
190+
font-weight: 500;
191+
max-width: 75%;
192+
border-width: 10px;
193+
border-color: #bfbfbf;
194+
box-shadow: 10px 10px 5px #EBEBEB; /*#888888*/
195+
padding: 1em;
196+
}
197+
198+
199+
.img-note {
200+
vertical-align: central;
201+
width: 2em;
202+
}
203+
204+
.footnotes {
205+
color: #00000080;
83206
}

0 commit comments

Comments
 (0)