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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -0
  3. data/Rakefile +20 -2
  4. data/bin/check_gemfile_lock_version +46 -0
  5. data/bin/release_bump +26 -0
  6. data/blogs/README.md +4 -0
  7. data/blogs/galaaz_2_0/galaaz_2_0.Rmd +385 -0
  8. data/blogs/galaaz_2_0/galaaz_2_0.md +409 -0
  9. data/blogs/galaaz_2_0/galaaz_2_0.tex +756 -0
  10. data/blogs/galaaz_2_0/images/galaaz-header.png +0 -0
  11. data/blogs/galaaz_2_0/images/galaaz-lockup-stacked.png +0 -0
  12. data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +76 -58
  13. data/blogs/galaaz_ggplot/galaaz_ggplot.md +188 -161
  14. data/blogs/galaaz_ggplot/galaaz_ggplot.tex +185 -117
  15. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
  16. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
  17. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
  18. data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
  19. data/blogs/galaaz_ggplot/images/galaaz-lockup-stacked.png +0 -0
  20. data/blogs/gknit/gknit.Rmd +48 -28
  21. data/blogs/gknit/gknit.md +60 -43
  22. data/blogs/gknit/gknit.tex +1409 -0
  23. data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
  24. data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
  25. data/blogs/gknit/gknit_files/figure-latex/bubble-1.png +0 -0
  26. data/blogs/gknit/images/galaaz-lockup-stacked.png +0 -0
  27. data/blogs/manual/images/galaaz-lockup-stacked.png +0 -0
  28. data/blogs/manual/manual.Rmd +161 -71
  29. data/blogs/manual/manual.md +573 -482
  30. data/blogs/manual/manual.tex +1113 -517
  31. data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
  32. data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
  33. data/blogs/manual/manual_files/figure-markdown_github/bubble-1.png +0 -0
  34. data/blogs/manual/manual_files/figure-markdown_github/diverging_bar.png +0 -0
  35. data/blogs/nse_dplyr/images/galaaz-lockup-stacked.png +0 -0
  36. data/blogs/nse_dplyr/nse_dplyr.Rmd +42 -8
  37. data/blogs/nse_dplyr/nse_dplyr.md +69 -50
  38. data/blogs/nse_dplyr/nse_dplyr.tex +1626 -0
  39. data/blogs/oh_my/images/galaaz-lockup-stacked.png +0 -0
  40. data/blogs/oh_my/oh_my.Rmd +206 -55
  41. data/blogs/oh_my/oh_my.md +247 -96
  42. data/blogs/oh_my/oh_my.tex +2038 -93
  43. data/blogs/r_on_rails_ledger/images/00_portfolio_page.png +0 -0
  44. data/blogs/r_on_rails_ledger/images/01_results_panel.png +0 -0
  45. data/blogs/r_on_rails_ledger/images/02_density_tail_risk.png +0 -0
  46. data/blogs/r_on_rails_ledger/images/03_mc_cone.png +0 -0
  47. data/blogs/r_on_rails_ledger/images/04_rolling_var.png +0 -0
  48. data/blogs/r_on_rails_ledger/images/galaaz-lockup-stacked.png +0 -0
  49. data/blogs/r_on_rails_ledger/r_on_rails_ledger.Rmd +354 -0
  50. data/blogs/r_on_rails_ledger/r_on_rails_ledger.md +365 -0
  51. data/blogs/r_on_rails_ledger/r_on_rails_ledger.tex +670 -0
  52. data/blogs/ruby_plot/images/galaaz-lockup-stacked.png +0 -0
  53. data/blogs/ruby_plot/ruby_plot.Rmd +56 -35
  54. data/blogs/ruby_plot/ruby_plot.md +63 -47
  55. data/blogs/ruby_plot/ruby_plot.tex +194 -125
  56. data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
  57. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
  58. data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
  59. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
  60. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
  61. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
  62. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
  63. data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
  64. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
  65. data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
  66. data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
  67. data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
  68. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  69. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  70. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  71. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  72. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  73. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  74. data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  75. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  76. data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  77. data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  78. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png +0 -0
  79. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
  80. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
  81. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
  82. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
  83. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
  84. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
  85. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
  86. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
  87. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
  88. data/blogs/ruby_plot/ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
  89. data/lib/galaaz/cli.rb +98 -13
  90. data/logos/icon-font/README.md +27 -0
  91. data/logos/icon-font/build_font.py +130 -0
  92. data/logos/icon-font/galaaz-mark.svg +34 -0
  93. data/script/omarchy/README.md +9 -2
  94. data/script/omarchy/fonts/galaaz.ttf +0 -0
  95. data/script/omarchy/galaaz-guide.sh +1 -1
  96. data/script/omarchy/install-galaaz.sh +8 -1
  97. data/script/omarchy/omarchy-menu.jsonc +21 -9
  98. data/sty/galaaz-header.png +0 -0
  99. data/sty/galaaz-headers-from-p3.tex +4 -0
  100. data/sty/galaaz.sty +76 -23
  101. data/version.rb +1 -1
  102. metadata +46 -7
  103. data/blogs/galaaz_ggplot/galaaz_ggplot.log +0 -754
  104. data/blogs/manual/manual.log +0 -1786
  105. data/blogs/nse_dplyr/nse_dplyr.log +0 -928
  106. data/blogs/oh_my/oh_my.log +0 -804
  107. data/blogs/ruby_plot/ruby_plot.log +0 -885
@@ -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: "../../sty/galaaz.sty"
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
- # Defines the plot theme (visualization). In this theme we remove major and minor
179
- # grids, borders and background. We also turn-off scientific notation.
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 = R.theme(panel__grid__major: E.element_blank())
201
+ global_theme =
202
+ R.theme(panel__grid__major: E.element_blank())
188
203
  # remove minor grids
189
- global_theme = global_theme + R.theme(panel__grid__minor: E.element_blank)
204
+ global_theme = global_theme +
205
+ R.theme(panel__grid__minor: E.element_blank)
190
206
  # remove border
191
- global_theme = global_theme + R.theme(panel__border: E.element_blank)
207
+ global_theme = global_theme +
208
+ R.theme(panel__border: E.element_blank)
192
209
  # remove background
193
- global_theme = global_theme + R.theme(panel__background: E.element_blank)
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
- R.theme(axis__text: E.element_text(size: 8, color: "#000080"))
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
- R.theme(axis__title: E.element_text(
200
- color: "#000080",
201
- face: "bold",
202
- size: 8,
203
- hjust: 1))
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, and if confidence is true the add a confidence interval, if
244
- # false does not add the confidence interval
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
- # Creates the graph title, properly formated for this theme
254
- # @param title [String] The title to add to the graph
255
- # @return textGrob that can be included in a graph
256
- #---------------------------------------------------------------------------------
257
-
258
- def graph_params(title: "", subtitle: "", caption: "", x_label: "", y_label: "")
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
- sp.group_by(color: :state, size: :popdensity) # try sp.group_by(color: :state)
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