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
@@ -101,7 +101,7 @@
101
101
  \usepackage[utf8]{inputenc}
102
102
 
103
103
  \usepackage{geometry}
104
- \geometry{a4paper, top=1in}
104
+ \geometry{a4paper, top=1.05in, headheight=30pt, headsep=14pt}
105
105
 
106
106
  % needed for kableExtra
107
107
  \usepackage{longtable}
@@ -122,29 +122,60 @@
122
122
  \usepackage{graphicx}
123
123
 
124
124
  \usepackage{fancyhdr}
125
- % set the header and foot style
126
- % style 'fancy' adds the section name on the header
127
- % and the page number on the footer
125
+ % Header: small Galaaz mark (left); page number + section title (right),
126
+ % matching classic LaTeX style: "4 AN EXTENSION TO THE EXAMPLE"
127
+ % (upright page number, uppercase italic section name).
128
+ % Logo paths cover repo blogs (../../sty/), installed ~/sty/, and local images/.
129
+ % Blogs may delay headers with \renewcommand{\galaazheaderfrompage}{3} after this sty
130
+ % (e.g. skip title/TOC and a logo splash page).
131
+ \newcommand{\galaazheaderfrompage}{1}
132
+ \newcommand{\galaazheaderlogo}{%
133
+ \raisebox{-0.12\height}{%
134
+ \IfFileExists{../../sty/galaaz-header.png}{%
135
+ \includegraphics[height=0.32in]{../../sty/galaaz-header.png}%
136
+ }{%
137
+ \IfFileExists{galaaz-header.png}{%
138
+ \includegraphics[height=0.32in]{galaaz-header.png}%
139
+ }{%
140
+ \IfFileExists{images/galaaz-header.png}{%
141
+ \includegraphics[height=0.32in]{images/galaaz-header.png}%
142
+ }{}%
143
+ }%
144
+ }%
145
+ }%
146
+ }
147
+ % Section title only in marks (no \thesection); page number is separate.
148
+ \renewcommand{\sectionmark}[1]{\markboth{#1}{}}
149
+ \renewcommand{\subsectionmark}[1]{}% keep the current section in the header
150
+ \newcommand{\galaazmaybeheaderlogo}{%
151
+ \ifnum\value{page}<\galaazheaderfrompage\relax\else\galaazheaderlogo\fi}
152
+ \newcommand{\galaazmayberighthead}{%
153
+ \ifnum\value{page}<\galaazheaderfrompage\relax
154
+ \else
155
+ \textup{\thepage}\hspace{1em}\textit{\MakeUppercase{\leftmark}}%
156
+ \fi
157
+ }
128
158
  \pagestyle{fancy}
129
-
130
- % style 'fancyhf' leaves header and footer empty
131
- %\fancyhf{}
132
-
133
- % sets the left head element to \rightmark, which contains the
134
- % current section (\leftmark is the current chapter)
135
- %\fancyhead[L]{\rightmark} .
136
-
137
- % sets the right head element to the page number.
138
- % \fancyhead[R]{\thepage}
139
-
140
- % lets the head rule disappear.
141
- % \renewcommand{\headrulewidth}{0pt}
142
- % Possible selectors for the optional argument of \fancyhead/\fancyfoot
143
- % are L (left), C (center) or R (right) for the position of the element
144
- % and E (even) or O (odd) to distinguish even and odd pages. If you omit
145
- % E/O the element is set for all pages.
146
-
147
- % \usepackage{lipsum}
159
+ \fancyhf{}
160
+ \fancyhead[L]{\galaazmaybeheaderlogo}
161
+ \fancyhead[R]{\galaazmayberighthead}
162
+ \renewcommand{\headrulewidth}{0.3pt}
163
+ \makeatletter
164
+ \renewcommand{\headrule}{%
165
+ \ifnum\value{page}<\galaazheaderfrompage\relax
166
+ \else
167
+ \hrule\@height\headrulewidth\@width\headwidth
168
+ \vskip-\headrulewidth
169
+ \fi
170
+ }
171
+ \makeatother
172
+ % First page often uses plain; same conditional header logic.
173
+ \fancypagestyle{plain}{%
174
+ \fancyhf{}%
175
+ \fancyhead[L]{\galaazmaybeheaderlogo}%
176
+ \fancyhead[R]{\galaazmayberighthead}%
177
+ \renewcommand{\headrulewidth}{0.3pt}%
178
+ }
148
179
 
149
180
  % make available command lastpage
150
181
  \usepackage{lastpage}
@@ -165,8 +196,34 @@
165
196
  % Command to import an R variable to latex
166
197
  \newcommand{\RtoLatex}[2]{\newcommand{#1}{#2}}
167
198
 
199
+ % Soft-wrap Pandoc highlighted code/output boxes (Shaded + Highlighting).
200
+ % This runs after Pandoc's default \DefineVerbatimEnvironment{Highlighting}
201
+ % (header includes come later in the generated .tex). Prefer manual line
202
+ % breaks in Rmd sources; breaklines is a safety net for leftovers/output.
203
+ % Requires TinyTeX/TeX Live package: tlmgr install fvextra
204
+ \IfFileExists{fvextra.sty}{%
205
+ \usepackage{fvextra}%
206
+ \DefineVerbatimEnvironment{Highlighting}{Verbatim}{%
207
+ breaklines=true,
208
+ breakanywhere=true,
209
+ breakindent=1.5em,
210
+ fontsize=\small,
211
+ commandchars=\\\{\}%
212
+ }%
213
+ }{%
214
+ % fancyvrb is already loaded by Pandoc; shrink code so more fits per line.
215
+ \DefineVerbatimEnvironment{Highlighting}{Verbatim}{%
216
+ fontsize=\small,
217
+ commandchars=\\\{\}%
218
+ }%
219
+ }
220
+
168
221
  %
169
222
  %\newcommand{\atraso}[1]{\color{red} \textbf {Tempo desde a Assinatura do Contrato: #1 dias}}
223
+ % No header on title/TOC (p.1) or splash logo page (p.2);
224
+ % logo + page number + section title from page 3 onward.
225
+ % Load after galaaz.sty.
226
+ \renewcommand{\galaazheaderfrompage}{3}
170
227
  \usepackage{bookmark}
171
228
  \IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
172
229
  \urlstyle{same}
@@ -187,6 +244,8 @@
187
244
  \setcounter{tocdepth}{2}
188
245
  \tableofcontents
189
246
  }
247
+ \begin{center}\includegraphics[width=0.45\linewidth]{images/galaaz-lockup-stacked} \end{center}
248
+
190
249
  According to Wikipedia ``Ruby is a dynamic, interpreted, reflective,
191
250
  object-oriented, general-purpose programming language. It was designed
192
251
  and developed in the mid-1990s by Yukihiro''Matz'' Matsumoto in Japan.''
@@ -194,41 +253,42 @@ It reached high popularity with the development of Ruby on Rails (RoR)
194
253
  by David Heinemeier Hansson. RoR is a web application framework first
195
254
  released around 2005. It makes extensive use of Ruby's metaprogramming
196
255
  features. With RoR, Ruby became very popular. According to
197
- \href{https://www.tiobe.com/tiobe-index/ruby/}{Ruby's Tiobe index} it
198
- peeked in popularity around 2008, then declined until 2015 when it
199
- started picking up again. At the time of this writing (November 2018),
200
- the Tiobe index puts Ruby in 16th position as most popular language.
201
-
202
- Python, a language similar to Ruby, ranks 4th in the index. Java, C and
203
- C++ take the first three positions. Ruby is often criticized for its
256
+ \href{https://www.tiobe.com/tiobe-index/ruby/}{Ruby's ranking in the
257
+ TIOBE index} it \textbf{peaked} in popularity around 2008, then declined
258
+ until 2015 when it started picking up again. As of the original
259
+ publication date (November 2018), TIOBE placed Ruby around 16th among
260
+ languages.
261
+
262
+ Python, often grouped with Ruby as a high-level scripting language,
263
+ ranked higher in that same snapshot. Ruby is often criticized for its
204
264
  focus on web applications. But Ruby can do
205
265
  \href{https://github.com/markets/awesome-ruby}{much more} than just web
206
- applications. Yet, for scientific computing, Ruby lags way behind Python
207
- and R. Python has Django framework for web, NumPy for numerical arrays,
208
- Pandas for data analysis. R is a free software environment for
209
- statistical computing and graphics with thousands of libraries for data
210
- analysis.
266
+ applications. Yet, for scientific computing, Ruby lags behind Python and
267
+ R. Python combines web frameworks such as Django with NumPy, pandas,
268
+ SciPy, and \textbf{a very large ecosystem} of domain-specific packages.
269
+ R is a free software environment for statistical computing and graphics
270
+ with thousands of libraries for data analysis.
211
271
 
212
272
  Until recently, there was no real perspective for Ruby to bridge this
213
273
  gap. Implementing a complete scientific computing infrastructure would
214
274
  take too long.
215
275
 
216
- \textbf{Galaaz 2.0} couples
217
- \textbf{\href{https://www.jruby.org/}{JRuby}} (Ruby on the JVM) with
218
- \textbf{GNU R}---the same R distribution used for data science
219
- everywhere. A \textbf{bridge} evaluates R from Ruby and exchanges data
220
- between the two processes so that, from Ruby, you call R functions and
221
- work with R objects using familiar Ruby syntax. In other words, a Ruby
222
- programmer can use the capabilities of R without memorizing all of R's
223
- syntax for day-to-day tasks.
276
+ \textbf{Galaaz 2.0} supports
277
+ \textbf{\href{https://www.jruby.org/}{JRuby}} or \textbf{CRuby} equally
278
+ and drives \textbf{GNU R}---the same R distribution used for data
279
+ science everywhere. A \textbf{bridge} evaluates R from Ruby and
280
+ exchanges data between the two processes so that, from Ruby, you call R
281
+ functions and work with R objects using familiar Ruby syntax. In other
282
+ words, a Ruby programmer can use the capabilities of R without
283
+ memorizing all of R's syntax for day-to-day tasks.
224
284
 
225
285
  An \textbf{earlier line of work} used Oracle's \textbf{GraalVM} with
226
286
  \textbf{TruffleRuby} and \textbf{FastR} so that Ruby and R could share
227
287
  one JVM runtime. That stack is \textbf{no longer} what Galaaz targets;
228
- today's Galaaz is developed and tested with \textbf{JRuby + GNU R} (see
229
- the project manual for setup and command-line tools).
288
+ today's Galaaz is developed and tested with \textbf{JRuby or CRuby + GNU
289
+ R} (see the project manual for setup and command-line tools).
230
290
 
231
- Library wrapping is a usual way of bringing features from one language
291
+ Library wrapping is a common way to bring features from one language
232
292
  into another. To improve performance, Python often wraps more efficient
233
293
  C libraries. For the Python developer, the existence of such C libraries
234
294
  is hidden. The problem with library wrapping is that for any new
@@ -239,12 +299,12 @@ language in Ruby. Doing so, all thousands of R libraries are available
239
299
  immediately to Ruby developers without any new wrapping effort.
240
300
 
241
301
  To show the power of Galaaz, we show in this article how Ruby can use
242
- R's ggplot2 library tranparantly bringing to Ruby the power of high
243
- quality scientific plotting. We also show that migrating from R to Ruby
244
- with Galaaz is a matter of small syntactic changes. By using Ruby, the R
245
- developer can use all of Ruby's powerful object-oriented features. Also,
246
- with Ruby, it becomes much easier to move code from the analysis phase
247
- to the production phase.
302
+ R's ggplot2 library \textbf{transparently}, bringing to Ruby the power
303
+ of high-quality scientific plotting. We also show that migrating from R
304
+ to Ruby with Galaaz is a matter of small syntactic changes. By using
305
+ Ruby, the R developer can use all of Ruby's powerful object-oriented
306
+ features. Also, with Ruby, it becomes much easier to move code from the
307
+ analysis phase to the production phase.
248
308
 
249
309
  In this article we will explore the R ToothGrowth dataset. To
250
310
  illustrate, we will create some boxplots. A primer on boxplot is
@@ -261,15 +321,16 @@ special knowledge.
261
321
 
262
322
  \href{https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021}{Here}
263
323
  is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby;
264
- the \textbf{ideas} still apply under Galaaz 2.0 with JRuby and GNU R.
324
+ the \textbf{ideas} still apply under Galaaz 2.0 with JRuby or CRuby and
325
+ GNU R.
265
326
 
266
327
  \section{gKnit}\label{gknit}
267
328
 
268
329
  \emph{Knitr} is an application that converts text written in rmarkdown
269
330
  to many different output formats. For instance, a writer can convert an
270
- rmarkdown document to HTML, \(LaTex\), docx and many other formats.
271
- Rmarkdown documents can contain text and \emph{code chunks}. Knitr
272
- formats code chunks in a grayed box in the output document. It also
331
+ rmarkdown document to HTML, LaTeX, Word, and many other formats. R
332
+ Markdown documents can contain text and \emph{code chunks}. knitr
333
+ formats code chunks in a shaded box in the output document. It also
273
334
  executes the code chunks and formats the output in a white box. Every
274
335
  line of output from the execution code is preceded by `\#\#'.
275
336
 
@@ -283,7 +344,7 @@ With \emph{gKnit} Ruby code chunks can share data.
283
344
  \section{Exploring the Dataset}\label{exploring-the-dataset}
284
345
 
285
346
  Let's start by exploring our selected dataset. ToothGrowth is an R
286
- dataset. A dataset is like a simple excel spreadsheet, in which each
347
+ dataset. A dataset is like a simple Excel spreadsheet, in which each
287
348
  column has only one type of data. For instance one column can have
288
349
  float, the other integer, and a third strings. This dataset analyzes the
289
350
  length of odontoblasts (cells responsible for tooth growth) in 60 guinea
@@ -293,17 +354,17 @@ or ascorbic acid (a form of vitamin C and coded as VC).
293
354
 
294
355
  The ToothGrowth dataset contains three columns: `len', `supp' and
295
356
  `dose'. Let's take a look at a few rows of this dataset. In Galaaz, R
296
- variables are accessed by using the corresponding Ruby symbol preceeded
297
- by the tilda (`\textasciitilde{}') function. Note in the following chunk
357
+ variables are accessed by using the corresponding Ruby symbol with the
358
+ tilde (\texttt{\textasciitilde{}}) operator. Note in the following chunk
298
359
  that `ToothGrowth' is the R variable and Ruby's `tooth\_growth' is
299
- assigned the value of `\textasciitilde:ToothGrowth'.
360
+ assigned the value of `\textasciitilde R{[}:ToothGrowth{]}'.
300
361
 
301
362
  \begin{Shaded}
302
363
  \begin{Highlighting}[]
303
364
  \CommentTok{\# Read the R ToothGrowth variable and assign it to the}
304
365
  \CommentTok{\# Ruby instance variable tooth\_growth that will be }
305
366
  \CommentTok{\# available to all Ruby chunks in this document.}
306
- \NormalTok{tooth\_growth }\OperatorTok{=} \OperatorTok{\textasciitilde{}}\WarningTok{:ToothGrowth}
367
+ \NormalTok{tooth\_growth }\OperatorTok{=} \OperatorTok{\textasciitilde{}}\ConstantTok{R}\KeywordTok{[}\WarningTok{:ToothGrowth}\KeywordTok{]}
307
368
  \CommentTok{\# print the first few elements of the dataset}
308
369
  \FunctionTok{puts}\NormalTok{ tooth\_growth}\AttributeTok{.head}
309
370
  \end{Highlighting}
@@ -340,7 +401,7 @@ The `dose' column contains a numeric value with either, 0.5, 1 or 2,
340
401
  although the first 6 rows as seen above only contain the 0.5 values.
341
402
  Even though those are number, they are better interpreted as a
342
403
  \href{https://swcarpentry.github.io/r-novice-inflammation/12-supp-factors/}{factor
343
- or cathegory}. So, let's convert our `dose' column from numeric to
404
+ or category}. So, let's convert our `dose' column from numeric to
344
405
  `factor'. In R, the function `as.factor' is used to convert data in a
345
406
  vector to factors. To use this function from Galaaz the dot (`.') in the
346
407
  function name is substituted by '\_\_' (double underline). The function
@@ -431,7 +492,7 @@ R, this would be written as
431
492
  you the flexibility to use either
432
493
  \texttt{R.ggplot(\textless{}dataset\textgreater{},\ ...)} or
433
494
  \texttt{\textless{}dataset\textgreater{}.ggplot(...)}. In the graph
434
- specification bellow, we use the second notation that looks more like
495
+ specification below, we use the second notation that looks more like
435
496
  Ruby.\\
436
497
  ggplot uses the `aes' method to specify x and y axes; in this case, the
437
498
  `dose' on the \(x\) axis and the `length' on the \(y\) axis: `E.aes(x:
@@ -447,7 +508,7 @@ For a boxplot, the geom is R.geom\_boxplot.
447
508
  \end{Highlighting}
448
509
  \end{Shaded}
449
510
 
450
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/dose_len.png}}
511
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/dose_len.png}}
451
512
 
452
513
  Great! We've just managed to create and save our first plot in Ruby with
453
514
  only four lines of code. We can now easily see with this plot a clear
@@ -469,8 +530,8 @@ The parameter to the `facet\_grid' method is a
469
530
 
470
531
  In Galaaz we give programmers the flexibility to use two different ways
471
532
  to write formulas. In the first way, we use Ruby expressions and the
472
- `.til' function. The formula `x \textasciitilde{} y', becomes `:x.til
473
- :y'. More information on expressions can be found in
533
+ `.til' function. The formula `x \textasciitilde{} y', becomes
534
+ `R{[}:x{]}.til :y'. More information on expressions can be found in
474
535
  \href{https://www.rubydoc.info/gems/galaaz/}{Galaaz Manual}.
475
536
 
476
537
  Another way of writing a formula is to use the `formula' function with
@@ -479,10 +540,11 @@ the actual formula as a string. The formula
479
540
  \texttt{R.formula("x\ \textasciitilde{}\ y")}. For more complex
480
541
  formulas, the use of the `formula' function is preferred.
481
542
 
482
- The formula \texttt{:all.til\ :supp} indicates to the `facet\_grid'
483
- function that it needs to facet the plot based on the \texttt{supp}
484
- variable and split the plot vertically. Changing the formula to
485
- \texttt{:supp.til\ :all} would split the plot horizontally.
543
+ The formula \texttt{R{[}:all{]}.til\ :supp} indicates to the
544
+ `facet\_grid' function that it needs to facet the plot based on the
545
+ \texttt{supp} variable and split the plot vertically. Changing the
546
+ formula to \texttt{R{[}:supp{]}.til\ :all} would split the plot
547
+ horizontally.
486
548
 
487
549
  \begin{Shaded}
488
550
  \begin{Highlighting}[]
@@ -490,13 +552,13 @@ variable and split the plot vertically. Changing the formula to
490
552
 
491
553
  \NormalTok{bp }\OperatorTok{=}\NormalTok{ base\_tooth }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.geom\_boxplot} \OperatorTok{+}
492
554
  \CommentTok{\# Split in vertical direction}
493
- \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\WarningTok{:all}\AttributeTok{.til} \OperatorTok{:}\NormalTok{supp)}
555
+ \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\ConstantTok{R}\KeywordTok{[}\WarningTok{:all}\KeywordTok{]}\AttributeTok{.til} \OperatorTok{:}\NormalTok{supp)}
494
556
 
495
557
  \FunctionTok{puts}\NormalTok{ bp}
496
558
  \end{Highlighting}
497
559
  \end{Shaded}
498
560
 
499
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facet_by_delivery.png}}
561
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facet_by_delivery.png}}
500
562
 
501
563
  It now becomes clear that although both methods of delivery have a
502
564
  direct impact on tooth growth, method (OJ) is non-linear having a higher
@@ -521,7 +583,7 @@ this command each `dose' factor gets its own color.
521
583
  \end{Highlighting}
522
584
  \end{Shaded}
523
585
 
524
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facets_by_delivery_color.png}}
586
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color.png}}
525
587
 
526
588
  Facetting helps us compare the general trends for each delivery method.
527
589
  Adding color allow us to compare specifically how each dosage impacts
@@ -567,7 +629,7 @@ experiment. For that, add the function `R.geom\_point' to the plot.
567
629
  \end{Highlighting}
568
630
  \end{Shaded}
569
631
 
570
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facets_with_points.png}}
632
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facets_with_points.png}}
571
633
 
572
634
  Now we can see the actual distribution of all the 60 subjects. Actually,
573
635
  this is not totally true. We have a hard time seing all 60 subjects. It
@@ -589,7 +651,7 @@ making them even easier to see.
589
651
  \end{Highlighting}
590
652
  \end{Shaded}
591
653
 
592
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facets_with_jitter.png}}
654
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facets_with_jitter.png}}
593
655
 
594
656
  Now we can see all 60 points in the graph. We have here a much higher
595
657
  information density and we can see outliers and subjects distribution.
@@ -629,14 +691,15 @@ order of the colors in the plot.
629
691
  \begin{Shaded}
630
692
  \begin{Highlighting}[]
631
693
  \NormalTok{bp }\OperatorTok{=}\NormalTok{ bp }\OperatorTok{+}
632
- \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}\WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{),}
633
- \WarningTok{breaks:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"2"}\NormalTok{,}\StringTok{"1"}\NormalTok{,}\StringTok{"0.5"}\NormalTok{))}
694
+ \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}
695
+ \WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{),}
696
+ \WarningTok{breaks:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"2"}\NormalTok{, }\StringTok{"1"}\NormalTok{, }\StringTok{"0.5"}\NormalTok{))}
634
697
 
635
698
  \FunctionTok{puts}\NormalTok{ bp}
636
699
  \end{Highlighting}
637
700
  \end{Shaded}
638
701
 
639
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facets_by_delivery_color2.png}}
702
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facets_by_delivery_color2.png}}
640
703
 
641
704
  \subsection{Violin Plot and Jitter}\label{violin-plot-and-jitter}
642
705
 
@@ -660,17 +723,19 @@ dot represents the median average value.
660
723
 
661
724
  \begin{Shaded}
662
725
  \begin{Highlighting}[]
663
- \NormalTok{violin }\OperatorTok{=}\NormalTok{ base\_tooth }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.geom\_violin}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{fill:} \WarningTok{:dose}\NormalTok{)) }\OperatorTok{+}
664
- \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\WarningTok{:all}\AttributeTok{.til} \OperatorTok{:}\NormalTok{supp) }\OperatorTok{+}
726
+ \NormalTok{violin }\OperatorTok{=}\NormalTok{ base\_tooth }\OperatorTok{+}
727
+ \ConstantTok{R}\AttributeTok{.geom\_violin}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{fill:} \WarningTok{:dose}\NormalTok{)) }\OperatorTok{+}
728
+ \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\ConstantTok{R}\KeywordTok{[}\WarningTok{:all}\KeywordTok{]}\AttributeTok{.til} \OperatorTok{:}\NormalTok{supp) }\OperatorTok{+}
665
729
  \ConstantTok{R}\AttributeTok{.geom\_jitter}\NormalTok{(}\WarningTok{shape:} \DecValTok{23}\NormalTok{, }\WarningTok{color:} \StringTok{"cyan3"}\NormalTok{, }\WarningTok{size:} \DecValTok{1}\NormalTok{) }\OperatorTok{+}
666
- \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}\WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{),}
667
- \WarningTok{breaks:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"2"}\NormalTok{,}\StringTok{"1"}\NormalTok{,}\StringTok{"0.5"}\NormalTok{))}
730
+ \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}
731
+ \WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{),}
732
+ \WarningTok{breaks:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"2"}\NormalTok{, }\StringTok{"1"}\NormalTok{, }\StringTok{"0.5"}\NormalTok{))}
668
733
 
669
734
  \FunctionTok{puts}\NormalTok{ violin}
670
735
  \end{Highlighting}
671
736
  \end{Shaded}
672
737
 
673
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/violin_with_jitter.png}}
738
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/violin_with_jitter.png}}
674
739
 
675
740
  This plot is an alternative to the original boxplot. For the final
676
741
  presentation, it is important to think which graphics will be best
@@ -710,7 +775,7 @@ we defined a caption variable using Ruby's Here Doc style).
710
775
  \end{Highlighting}
711
776
  \end{Shaded}
712
777
 
713
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facets_with_decorations.png}}
778
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facets_with_decorations.png}}
714
779
 
715
780
  \subsection{The Corp Theme}\label{the-corp-theme}
716
781
 
@@ -732,42 +797,43 @@ axis and written in `bold'.
732
797
  \ControlFlowTok{module} \DataTypeTok{CorpTheme}
733
798
 
734
799
  \ConstantTok{R}\AttributeTok{.install\_and\_loads} \VerbatimStringTok{\textquotesingle{}RColorBrewer\textquotesingle{}}
735
-
736
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
737
- \CommentTok{\# face can be (1=plain, 2=bold, 3=italic, 4=bold{-}italic)}
738
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
739
-
800
+
801
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
802
+ \CommentTok{\# face: 1=plain, 2=bold, 3=italic, 4=bold{-}italic}
803
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
804
+
740
805
  \ControlFlowTok{def} \DecValTok{self}\AttributeTok{.text\_element}\NormalTok{(size, }\WarningTok{face:} \StringTok{"plain"}\NormalTok{, }\WarningTok{hjust:} \DecValTok{nil}\NormalTok{)}
741
- \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}\WarningTok{color:} \StringTok{"\#000080"}\NormalTok{, }
806
+ \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}\WarningTok{color:} \StringTok{"\#000080"}\NormalTok{,}
742
807
  \WarningTok{face:}\NormalTok{ face,}
743
808
  \WarningTok{size:}\NormalTok{ size,}
744
- \WarningTok{hjust:}\NormalTok{ hjust)}
809
+ \WarningTok{hjust:}\NormalTok{ hjust)}
745
810
  \ControlFlowTok{end}
746
-
747
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
748
- \CommentTok{\# Defines the plot theme (visualization). In this theme we remove major and minor}
749
- \CommentTok{\# grids, borders and background. We also turn{-}off scientific notation.}
750
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
751
-
811
+
812
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
813
+ \CommentTok{\# Plot theme: no major/minor grids or borders; optional}
814
+ \CommentTok{\# background for facets; turn off scientific notation.}
815
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
816
+
752
817
  \ControlFlowTok{def} \DecValTok{self}\AttributeTok{.global\_theme}\NormalTok{(faceted }\OperatorTok{=} \DecValTok{false}\NormalTok{)}
753
-
818
+
754
819
  \ConstantTok{R}\AttributeTok{.options}\NormalTok{(}\WarningTok{scipen:} \DecValTok{999}\NormalTok{) }\CommentTok{\# turn{-}off scientific notation like 1e+48}
755
- \CommentTok{\# R.theme\_set(R.theme\_bw)}
756
-
820
+ \CommentTok{\# R.theme\_set(R.theme\_bw)}
821
+
757
822
  \CommentTok{\# remove major grids}
758
823
  \NormalTok{ gb }\OperatorTok{=} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_major:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{())}
759
824
  \CommentTok{\# remove minor grids}
760
825
  \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_minor:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
761
- \CommentTok{\# gb = R.theme(panel\_\_grid\_\_minor: E.element\_blank)}
762
826
  \CommentTok{\# remove border}
763
827
  \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_border:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
764
- \CommentTok{\# remove background. When working with faceted graphs, the background makes}
765
- \CommentTok{\# it easier to see each facet, so leave it}
766
- \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_background:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{) }\ControlFlowTok{if} \OperatorTok{!}\NormalTok{faceted}
828
+ \CommentTok{\# Keep background on faceted plots (helps separate facets)}
829
+ \ControlFlowTok{if} \OperatorTok{!}\NormalTok{faceted}
830
+ \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_background:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
831
+ \ControlFlowTok{end}
767
832
  \CommentTok{\# Change axis font}
768
833
  \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_text:}\NormalTok{ text\_element(}\DecValTok{8}\NormalTok{))}
769
834
  \CommentTok{\# change axis title font}
770
- \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_title:}\NormalTok{ text\_element(}\DecValTok{10}\NormalTok{, }\WarningTok{face:} \StringTok{"bold"}\NormalTok{, }\WarningTok{hjust:} \DecValTok{1}\NormalTok{))}
835
+ \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}
836
+ \WarningTok{axis\_\_title:}\NormalTok{ text\_element(}\DecValTok{10}\NormalTok{, }\WarningTok{face:} \StringTok{"bold"}\NormalTok{, }\WarningTok{hjust:} \DecValTok{1}\NormalTok{))}
771
837
  \CommentTok{\# change font of title}
772
838
  \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{title:}\NormalTok{ text\_element(}\DecValTok{12}\NormalTok{, }\WarningTok{face:} \StringTok{"bold"}\NormalTok{))}
773
839
  \CommentTok{\# change font of subtitle}
@@ -776,7 +842,7 @@ axis and written in `bold'.
776
842
  \NormalTok{ gb }\OperatorTok{=}\NormalTok{ gb }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{plot\_\_caption:}\NormalTok{ text\_element(}\DecValTok{8}\NormalTok{))}
777
843
 
778
844
  \ControlFlowTok{end}
779
-
845
+
780
846
  \ControlFlowTok{end}
781
847
  \end{Highlighting}
782
848
  \end{Shaded}
@@ -799,7 +865,7 @@ Here is our final boxplot, without jitter.
799
865
  \end{Highlighting}
800
866
  \end{Shaded}
801
867
 
802
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/final_box_plot.png}}
868
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/final_box_plot.png}}
803
869
 
804
870
  And here is the final violin plot, with jitter and the same look and
805
871
  feel of the corporate boxplot.
@@ -810,7 +876,7 @@ feel of the corporate boxplot.
810
876
  \end{Highlighting}
811
877
  \end{Shaded}
812
878
 
813
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/final_violin_plot.png}}
879
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/final_violin_plot.png}}
814
880
 
815
881
  \subsection{Another View}\label{another-view}
816
882
 
@@ -826,9 +892,12 @@ of graphics}.
826
892
  \DocumentationTok{Each animal received one of three dose levels of vitamin C.}
827
893
  \ControlFlowTok{EOT}
828
894
 
829
- \NormalTok{bp }\OperatorTok{=}\NormalTok{ tooth\_growth}\AttributeTok{.ggplot}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{x:} \WarningTok{:supp}\NormalTok{, }\WarningTok{y:} \WarningTok{:len}\NormalTok{, }\WarningTok{group:} \WarningTok{:supp}\NormalTok{)) }\OperatorTok{+}
830
- \ConstantTok{R}\AttributeTok{.geom\_boxplot}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{fill:} \WarningTok{:supp}\NormalTok{)) }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\WarningTok{:all}\AttributeTok{.til} \OperatorTok{:}\NormalTok{dose) }\OperatorTok{+}
831
- \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}\WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{)) }\OperatorTok{+}
895
+ \NormalTok{bp }\OperatorTok{=}\NormalTok{ tooth\_growth}\AttributeTok{.ggplot}\NormalTok{(}
896
+ \ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{x:} \WarningTok{:supp}\NormalTok{, }\WarningTok{y:} \WarningTok{:len}\NormalTok{, }\WarningTok{group:} \WarningTok{:supp}\NormalTok{)) }\OperatorTok{+}
897
+ \ConstantTok{R}\AttributeTok{.geom\_boxplot}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{fill:} \WarningTok{:supp}\NormalTok{)) }\OperatorTok{+}
898
+ \ConstantTok{R}\AttributeTok{.facet\_grid}\NormalTok{(}\ConstantTok{R}\KeywordTok{[}\WarningTok{:all}\KeywordTok{]}\AttributeTok{.til} \OperatorTok{:}\NormalTok{dose) }\OperatorTok{+}
899
+ \ConstantTok{R}\AttributeTok{.scale\_fill\_manual}\NormalTok{(}
900
+ \WarningTok{values:} \ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\StringTok{"cyan"}\NormalTok{, }\StringTok{"deepskyblue4"}\NormalTok{)) }\OperatorTok{+}
832
901
  \ConstantTok{R}\AttributeTok{.labs}\NormalTok{(}\WarningTok{title:} \StringTok{"Tooth Growth: Length by Dose"}\NormalTok{,}
833
902
  \WarningTok{subtitle:} \StringTok{"Faceted by dose"}\NormalTok{,}
834
903
  \WarningTok{x:} \StringTok{"Delivery method"}\NormalTok{, }\WarningTok{y:} \StringTok{"Teeth length"}\NormalTok{,}
@@ -839,7 +908,7 @@ of graphics}.
839
908
  \end{Highlighting}
840
909
  \end{Shaded}
841
910
 
842
- \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/figure-latex/facet_by_dose.png}}
911
+ \pandocbounded{\includegraphics[keepaspectratio]{ruby_plot_files/ruby_plot_files/figure-latex/facet_by_dose.png}}
843
912
 
844
913
  \section{Conclusion}\label{conclusion}
845
914
 
@@ -856,15 +925,16 @@ enormous endeavour and would probably never be accomplished. Today's
856
925
  data scientists would certainly stick with either Python or R. Now, both
857
926
  the Ruby and R communities can benefit from this marriage:
858
927
  \textbf{Galaaz 2.0} uses \textbf{standard GNU R} for statistics and
859
- graphics and \textbf{JRuby} for application code, threading, and the JVM
860
- ecosystem. We presented the process to couple Ruby and R; the coupling
861
- is implemented by the Galaaz bridge and \textbf{gKnit} for literate
862
- documents, not by a single GraalVM polyglot runtime.
928
+ graphics and \textbf{JRuby or CRuby} for application code (prefer
929
+ \textbf{JRuby} when you want real threads and the JVM ecosystem). We
930
+ presented the process to couple Ruby and R; the coupling is implemented
931
+ by the Galaaz bridge and \textbf{gKnit} for literate documents, not by a
932
+ single GraalVM polyglot runtime.
863
933
 
864
934
  For performance, expect \textbf{ordinary GNU R} behaviour for model
865
- fitting and plotting, while \textbf{JRuby} gives \textbf{real parallel
866
- threads} on the Ruby side and access to Java libraries when you need
867
- them.
935
+ fitting and plotting, while \textbf{JRuby} can give \textbf{real
936
+ parallel threads} on the Ruby side and access to Java libraries when you
937
+ need them.
868
938
 
869
939
  This article has shown how to improve a plot step-by-step. Starting from
870
940
  a very simple boxplot with all default configurations, we moved slowly
@@ -885,10 +955,8 @@ Rubyist trying to write articles, blogs or documentation for Ruby.
885
955
  \begin{itemize}
886
956
  \tightlist
887
957
  \item
888
- \textbf{JRuby} --- Ruby on the JVM
889
- (\href{https://www.jruby.org/}{jruby.org})
890
- \item
891
- A \textbf{JDK} compatible with your JRuby version
958
+ \textbf{JRuby} and a compatible \textbf{JDK}, \emph{or} \textbf{CRuby
959
+ 3.3+}
892
960
  \item
893
961
  \textbf{GNU R} --- \texttt{R} on your \texttt{PATH}, with
894
962
  compilers/tools available if packages must be built from source
@@ -933,8 +1001,9 @@ required.
933
1001
  In Ruby code:
934
1002
  \texttt{require\ \textquotesingle{}galaaz\textquotesingle{}}
935
1003
  \item
936
- For running scripts with the correct JRuby and JVM options, use
937
- \textbf{\texttt{bin/galaaz-jruby}} as described in the manual.
1004
+ Run Ruby with \textbf{\texttt{bin/galaaz-ruby}} (either engine) or
1005
+ \textbf{\texttt{bin/galaaz-jruby}} when you need JRuby JVM flags (see
1006
+ the manual).
938
1007
  \end{itemize}
939
1008
 
940
1009
  \end{document}