galaaz 2.1.7 → 2.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +39 -0
- data/Rakefile +20 -2
- data/bin/check_gemfile_lock_version +46 -0
- data/bin/release_bump +26 -0
- data/blogs/README.md +4 -0
- data/blogs/galaaz_2_0/galaaz_2_0.Rmd +385 -0
- data/blogs/galaaz_2_0/galaaz_2_0.md +409 -0
- data/blogs/galaaz_2_0/galaaz_2_0.tex +756 -0
- data/blogs/galaaz_2_0/images/galaaz-header.png +0 -0
- data/blogs/galaaz_2_0/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +76 -58
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +188 -161
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +185 -117
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/gknit/gknit.Rmd +48 -28
- data/blogs/gknit/gknit.md +60 -43
- data/blogs/gknit/gknit.tex +1409 -0
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
- data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/manual/manual.Rmd +161 -71
- data/blogs/manual/manual.md +573 -482
- data/blogs/manual/manual.tex +1113 -517
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-markdown_github/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-markdown_github/diverging_bar.png +0 -0
- data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/nse_dplyr/nse_dplyr.Rmd +42 -8
- data/blogs/nse_dplyr/nse_dplyr.md +69 -50
- data/blogs/nse_dplyr/nse_dplyr.tex +1626 -0
- data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/oh_my/oh_my.Rmd +206 -55
- data/blogs/oh_my/oh_my.md +247 -96
- data/blogs/oh_my/oh_my.tex +2038 -93
- data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
- data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
- data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
- data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
- data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
- data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
- data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
- data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
- data/blogs/ruby_plot/ruby_plot.Rmd +56 -35
- data/blogs/ruby_plot/ruby_plot.md +63 -47
- data/blogs/ruby_plot/ruby_plot.tex +194 -125
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/lib/galaaz/cli.rb +98 -13
- data/logos/icon-font/README.md +27 -0
- data/logos/icon-font/build_font.py +130 -0
- data/logos/icon-font/galaaz-mark.svg +34 -0
- data/script/omarchy/README.md +9 -2
- data/script/omarchy/fonts/galaaz.ttf +0 -0
- data/script/omarchy/galaaz-guide.sh +1 -1
- data/script/omarchy/install-galaaz.sh +8 -1
- data/script/omarchy/omarchy-menu.jsonc +21 -9
- data/sty/galaaz-header.png +0 -0
- data/sty/galaaz-headers-from-p3.tex +4 -0
- data/sty/galaaz.sty +76 -23
- data/version.rb +1 -1
- metadata +46 -7
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -754
- data/blogs/manual/manual.log +0 -1786
- data/blogs/nse_dplyr/nse_dplyr.log +0 -928
- data/blogs/oh_my/oh_my.log +0 -804
- data/blogs/ruby_plot/ruby_plot.log +0 -885
|
Binary file
|
|
Binary file
|
|
@@ -8,9 +8,17 @@ output:
|
|
|
8
8
|
html_document:
|
|
9
9
|
self_contained: true
|
|
10
10
|
keep_md: true
|
|
11
|
+
toc: true
|
|
12
|
+
toc_float: true
|
|
13
|
+
toc_depth: 2
|
|
14
|
+
number_sections: true
|
|
15
|
+
includes:
|
|
16
|
+
before_body: _logo_before_body.html
|
|
11
17
|
pdf_document:
|
|
12
18
|
includes:
|
|
13
|
-
in_header:
|
|
19
|
+
in_header:
|
|
20
|
+
- "../../sty/galaaz.sty"
|
|
21
|
+
- "../../sty/galaaz-headers-from-p3.tex"
|
|
14
22
|
keep_tex: yes
|
|
15
23
|
number_sections: yes
|
|
16
24
|
toc: true
|
|
@@ -21,7 +29,13 @@ fontsize: 11pt
|
|
|
21
29
|
---
|
|
22
30
|
|
|
23
31
|
```{r setup, echo=FALSE}
|
|
32
|
+
# Narrower console width so printed output fits PDF code boxes better.
|
|
33
|
+
options(width = 70)
|
|
34
|
+
```
|
|
24
35
|
|
|
36
|
+
```{r brand_logo, echo=FALSE, fig.align='center', out.width='45%', eval=knitr::is_latex_output()}
|
|
37
|
+
# PDF only — HTML uses _logo_before_body.html (above the TOC).
|
|
38
|
+
knitr::include_graphics("images/galaaz-lockup-stacked.png")
|
|
25
39
|
```
|
|
26
40
|
|
|
27
41
|
# Introduction
|
|
@@ -171,38 +185,43 @@ not use scientific notation and the preferred color is blue.
|
|
|
171
185
|
```{ruby global_theme_rb}
|
|
172
186
|
# corp_theme.rb
|
|
173
187
|
# defines the corporate theme for all plots
|
|
174
|
-
|
|
188
|
+
|
|
175
189
|
module CorpTheme
|
|
176
190
|
|
|
177
|
-
|
|
178
|
-
#
|
|
179
|
-
#
|
|
180
|
-
|
|
181
|
-
|
|
191
|
+
# ---------------------------------------------------------------
|
|
192
|
+
# Plot theme: no major/minor grids, borders, or background;
|
|
193
|
+
# turn off scientific notation.
|
|
194
|
+
# ---------------------------------------------------------------
|
|
195
|
+
|
|
182
196
|
def self.global_theme
|
|
183
|
-
|
|
197
|
+
|
|
184
198
|
R.options(scipen: 999) # turn-off scientific notation like 1e+48
|
|
185
|
-
|
|
199
|
+
|
|
186
200
|
# remove major grids
|
|
187
|
-
global_theme =
|
|
201
|
+
global_theme =
|
|
202
|
+
R.theme(panel__grid__major: E.element_blank())
|
|
188
203
|
# remove minor grids
|
|
189
|
-
global_theme = global_theme +
|
|
204
|
+
global_theme = global_theme +
|
|
205
|
+
R.theme(panel__grid__minor: E.element_blank)
|
|
190
206
|
# remove border
|
|
191
|
-
global_theme = global_theme +
|
|
207
|
+
global_theme = global_theme +
|
|
208
|
+
R.theme(panel__border: E.element_blank)
|
|
192
209
|
# remove background
|
|
193
|
-
global_theme = global_theme +
|
|
210
|
+
global_theme = global_theme +
|
|
211
|
+
R.theme(panel__background: E.element_blank)
|
|
194
212
|
# Change axis font
|
|
195
213
|
global_theme = global_theme +
|
|
196
|
-
|
|
214
|
+
R.theme(axis__text: E.element_text(
|
|
215
|
+
size: 8, color: "#000080"))
|
|
197
216
|
# change color of axis titles
|
|
198
217
|
global_theme = global_theme +
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
218
|
+
R.theme(axis__title: E.element_text(
|
|
219
|
+
color: "#000080",
|
|
220
|
+
face: "bold",
|
|
221
|
+
size: 8,
|
|
222
|
+
hjust: 1))
|
|
204
223
|
end
|
|
205
|
-
|
|
224
|
+
|
|
206
225
|
end
|
|
207
226
|
```
|
|
208
227
|
|
|
@@ -211,7 +230,7 @@ We now define a ScatterPlot class:
|
|
|
211
230
|
```{ruby ScatterPlot_rb}
|
|
212
231
|
# ScatterPlot.rb
|
|
213
232
|
# creates a scatter plot and allow some configuration
|
|
214
|
-
|
|
233
|
+
|
|
215
234
|
class ScatterPlot
|
|
216
235
|
|
|
217
236
|
attr_accessor :title
|
|
@@ -219,55 +238,55 @@ class ScatterPlot
|
|
|
219
238
|
attr_accessor :caption
|
|
220
239
|
attr_accessor :x_label
|
|
221
240
|
attr_accessor :y_label
|
|
222
|
-
|
|
223
|
-
|
|
241
|
+
|
|
242
|
+
# ---------------------------------------------------------------
|
|
224
243
|
# Initialize the plot with the data and the x and y variables
|
|
225
|
-
|
|
244
|
+
# ---------------------------------------------------------------
|
|
226
245
|
|
|
227
246
|
def initialize(data, x:, y:)
|
|
228
247
|
@data = data
|
|
229
248
|
@x = x
|
|
230
249
|
@y = y
|
|
231
250
|
end
|
|
232
|
-
|
|
233
|
-
|
|
251
|
+
|
|
252
|
+
# ---------------------------------------------------------------
|
|
234
253
|
# Define groupings by color and size
|
|
235
|
-
|
|
254
|
+
# ---------------------------------------------------------------
|
|
236
255
|
|
|
237
256
|
def group_by(color:, size:)
|
|
238
257
|
@color_by = color
|
|
239
258
|
@size_by = size
|
|
240
259
|
end
|
|
241
260
|
|
|
242
|
-
|
|
243
|
-
# Add a smoothing line
|
|
244
|
-
#
|
|
245
|
-
#---------------------------------------------------------------------------------
|
|
261
|
+
# ---------------------------------------------------------------
|
|
262
|
+
# Add a smoothing line; confidence: true draws a CI band.
|
|
263
|
+
# ---------------------------------------------------------------
|
|
246
264
|
|
|
247
265
|
def add_smoothing_line(method:, confidence: true)
|
|
248
266
|
@method = method
|
|
249
267
|
@confidence = confidence
|
|
250
268
|
end
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
#
|
|
254
|
-
# @param title [String]
|
|
255
|
-
# @return
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
def graph_params(title: "", subtitle: "", caption: "",
|
|
269
|
+
|
|
270
|
+
# ---------------------------------------------------------------
|
|
271
|
+
# Graph title / labels, formatted for this theme.
|
|
272
|
+
# @param title [String] title to add to the graph
|
|
273
|
+
# @return labs() result that can be included in a graph
|
|
274
|
+
# ---------------------------------------------------------------
|
|
275
|
+
|
|
276
|
+
def graph_params(title: "", subtitle: "", caption: "",
|
|
277
|
+
x_label: "", y_label: "")
|
|
259
278
|
R.labs(
|
|
260
|
-
title: title,
|
|
261
|
-
subtitle: subtitle,
|
|
279
|
+
title: title,
|
|
280
|
+
subtitle: subtitle,
|
|
262
281
|
caption: caption,
|
|
263
|
-
y_label: y_label,
|
|
264
|
-
x_label: x_label,
|
|
282
|
+
y_label: y_label,
|
|
283
|
+
x_label: x_label,
|
|
265
284
|
)
|
|
266
285
|
end
|
|
267
286
|
|
|
268
|
-
|
|
287
|
+
# ---------------------------------------------------------------
|
|
269
288
|
# Prepare the plot's points
|
|
270
|
-
|
|
289
|
+
# ---------------------------------------------------------------
|
|
271
290
|
|
|
272
291
|
def points
|
|
273
292
|
params = {}
|
|
@@ -275,30 +294,28 @@ class ScatterPlot
|
|
|
275
294
|
params[:size] = @size_by if @size_by
|
|
276
295
|
R.geom_point(E.aes(params))
|
|
277
296
|
end
|
|
278
|
-
|
|
279
|
-
|
|
297
|
+
|
|
298
|
+
# ---------------------------------------------------------------
|
|
280
299
|
# Plots the scatterplot
|
|
281
|
-
|
|
300
|
+
# ---------------------------------------------------------------
|
|
282
301
|
|
|
283
302
|
def plot
|
|
284
303
|
gg = @data.ggplot(E.aes(x: @x, y: @y)) +
|
|
285
|
-
points +
|
|
304
|
+
points +
|
|
286
305
|
R.geom_smooth(method: @method, se: @confidence) +
|
|
287
306
|
R.xlim(R.c(0, 0.1)) +
|
|
288
|
-
R.ylim(R.c(0, 500000)) +
|
|
307
|
+
R.ylim(R.c(0, 500000)) +
|
|
289
308
|
graph_params(title: @title,
|
|
290
|
-
subtitle: @subtitle,
|
|
291
|
-
y_label: @y_label,
|
|
292
|
-
x_label: @x_label,
|
|
309
|
+
subtitle: @subtitle,
|
|
310
|
+
y_label: @y_label,
|
|
311
|
+
x_label: @x_label,
|
|
293
312
|
caption: @caption) +
|
|
294
313
|
CorpTheme.global_theme
|
|
295
314
|
|
|
296
315
|
puts gg
|
|
297
|
-
|
|
298
316
|
end
|
|
299
|
-
|
|
300
|
-
end
|
|
301
317
|
|
|
318
|
+
end
|
|
302
319
|
```
|
|
303
320
|
|
|
304
321
|
And this is the final code for making the scatter plot with the midwest data
|
|
@@ -313,9 +330,10 @@ sp.subtitle = "Area Vs Population"
|
|
|
313
330
|
sp.caption = "Source: midwest"
|
|
314
331
|
sp.x_label = "Area"
|
|
315
332
|
sp.y_label = "Population"
|
|
316
|
-
|
|
333
|
+
# try: sp.group_by(color: :state)
|
|
334
|
+
sp.group_by(color: :state, size: :popdensity)
|
|
317
335
|
# available methods: "lm", "glm", "loess", "gam"
|
|
318
|
-
sp.add_smoothing_line(method: "glm")
|
|
336
|
+
sp.add_smoothing_line(method: "glm")
|
|
319
337
|
sp.plot
|
|
320
338
|
```
|
|
321
339
|
|