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}
@@ -183,8 +240,8 @@
183
240
  \apptocmd{\@title}{\par {\large #1 \par}}{}{}
184
241
  }
185
242
  \makeatother
186
- \subtitle{An example of tightly coupling Ruby and R (JRuby + GNU R,
187
- Galaaz 2.0)}
243
+ \subtitle{An example of tightly coupling Ruby and R (JRuby or CRuby +
244
+ GNU R, Galaaz 2.0)}
188
245
  \author{Rodrigo Botafogo}
189
246
  \date{16 October 2018 (narrative updated for Galaaz 2.0, 2026)}
190
247
 
@@ -195,6 +252,8 @@ Galaaz 2.0)}
195
252
  \setcounter{tocdepth}{2}
196
253
  \tableofcontents
197
254
  }
255
+ \begin{center}\includegraphics[width=0.45\linewidth]{images/galaaz-lockup-stacked} \end{center}
256
+
198
257
  \section{Introduction}\label{introduction}
199
258
 
200
259
  Galaaz is a system for tightly coupling Ruby and R. Ruby is a powerful
@@ -202,22 +261,23 @@ language, with a large community, a very large set of libraries and
202
261
  great for web development. However, it lacks libraries for data science,
203
262
  statistics, scientific plotting and machine learning. On the other hand,
204
263
  R is considered one of the most powerful languages for solving all of
205
- the above problems. Maybe the strongest competitor to R is Python with
206
- libraries such as NumPy, Panda, SciPy, SciKit-Learn and a couple more.
264
+ the above problems. \textbf{Python} is a strong competitor: NumPy,
265
+ pandas, SciPy, and scikit-learn are widely used examples among
266
+ \textbf{many thousands} of packages on PyPI for numerical and ML work.
207
267
 
208
268
  With Galaaz we do not intend to re-implement any of the scientific
209
269
  libraries in R; we allow for very tight coupling between the two
210
270
  languages to the point that the Ruby developer does not need to think
211
271
  about R syntax for every call. \textbf{Galaaz 2.0} does this with
212
- \textbf{\href{https://www.jruby.org/}{JRuby}} and \textbf{GNU R}: a
213
- \textbf{bridge} evaluates R from Ruby and exchanges data between
214
- processes.
272
+ \textbf{\href{https://www.jruby.org/}{JRuby}} or \textbf{CRuby} and
273
+ \textbf{GNU R}: a \textbf{bridge} evaluates R from Ruby and exchanges
274
+ data between processes.
215
275
 
216
276
  An \textbf{earlier} Galaaz prototype used Oracle's \textbf{GraalVM} with
217
277
  \textbf{TruffleRuby} and \textbf{FastR} in one JVM. That stack is
218
278
  \textbf{historical}; today's documentation and tooling assume
219
- \textbf{JRuby + GNU R} (see the project manual and
220
- \textbf{\texttt{bin/galaaz-jruby}} / \textbf{\texttt{bin/gknit}}).
279
+ \textbf{NewBridge on JRuby or CRuby} (see the project manual and
280
+ \textbf{\texttt{bin/galaaz-ruby}} / \textbf{\texttt{bin/gknit}}).
221
281
 
222
282
  For background on the old stack:
223
283
 
@@ -258,7 +318,8 @@ Arthurian legend.
258
318
  \begin{itemize}
259
319
  \tightlist
260
320
  \item
261
- \textbf{JRuby} and a compatible \textbf{JDK}
321
+ \textbf{JRuby} and a compatible \textbf{JDK}, \emph{or} \textbf{CRuby
322
+ 3.3+}
262
323
  \item
263
324
  \textbf{GNU R} on your \texttt{PATH}
264
325
  \end{itemize}
@@ -274,9 +335,9 @@ but could be installed prior to the demo if desired:
274
335
  gridExtra
275
336
  \end{itemize}
276
337
 
277
- Installation of R packages requires a development environment. In Linux,
278
- the gnu compiler and tools should be enough. I am not sure what is
279
- needed on the Mac.
338
+ Installation of R packages requires a development environment. On Linux,
339
+ a typical build toolchain (GCC, headers) is usually enough. On macOS,
340
+ Apple's \textbf{Xcode Command Line Tools} are commonly required.
280
341
 
281
342
  In order to run the `specs' the following Ruby package is necessary:
282
343
 
@@ -296,38 +357,38 @@ In order to run the `specs' the following Ruby package is necessary:
296
357
 
297
358
  \subsection{Running the demo}\label{running-the-demo}
298
359
 
299
- The ggplot for this demos was extracted from:
360
+ The ggplot examples for this demo were adapted from:
300
361
  \url{http://r-statistics.co/Top50-Ggplot2-Visualizations-MasterList-R-Code.html}.
301
362
 
302
- On the console do
363
+ At the shell, from a suitable Galaaz environment:
303
364
 
304
365
  \begin{verbatim}
305
- > galaaz master_list:scatter_plot
366
+ galaaz master_list:scatter_plot
306
367
  \end{verbatim}
307
368
 
308
369
  \subsection{Running other demos}\label{running-other-demos}
309
370
 
310
- Doing on the console
371
+ Running
311
372
 
312
373
  \begin{verbatim}
313
- > galaaz -T
374
+ galaaz -T
314
375
  \end{verbatim}
315
376
 
316
- will show a list with all available demos. To run any of the demos in
317
- the list, substitute the call to `rake' to `galaaz'. For instance, one
318
- of the examples in the list is `rake sthda:bar'. In order to run this
319
- example just do `galaaz sthda:bar'. Doing `galaaz sthda:all' will run
320
- all demos in the sthda cathegory. Some of the examples require `rspec'
321
- do be available. To install `rspec' just do `gem install rspec'.
377
+ lists available demo tasks. To run a demo, use \textbf{\texttt{galaaz}}
378
+ where you would otherwise invoke \textbf{\texttt{rake}}. For example, if
379
+ the list shows \texttt{rake\ sthda:bar}, run \texttt{galaaz\ sthda:bar}.
380
+ To run every demo in the \textbf{sthda} category, use
381
+ \texttt{galaaz\ sthda:all}. Some examples require \textbf{rspec};
382
+ install it with \texttt{gem\ install\ rspec}.
322
383
 
323
384
  \section{The demo code}\label{the-demo-code}
324
385
 
325
386
  The following is the Ruby code and plot for the above example. There is
326
- a small difference between the code in the example and the code bellow.
327
- If the example is ran, the plot will appear on the screen, bellow, we
328
- generate an `svg' image and then include it in this document. In order
329
- to generate and image, the R.svg device is used. To generate the plot on
330
- the screen, use the R.awt device, as commented on the code.
387
+ a small difference between the code in the example and the code below.
388
+ If the example is \textbf{run}, the plot will appear on the screen;
389
+ below, we generate an SVG image and then include it in this document. In
390
+ order to generate and image, the R.svg device is used. To generate the
391
+ plot on the screen, use the R.awt device, as commented on the code.
331
392
 
332
393
  \begin{Shaded}
333
394
  \begin{Highlighting}[]
@@ -338,7 +399,7 @@ the screen, use the R.awt device, as commented on the code.
338
399
  \ConstantTok{R}\AttributeTok{.options}\NormalTok{(}\WarningTok{scipen:} \DecValTok{999}\NormalTok{) }\CommentTok{\# turn{-}off scientific notation like 1e+48}
339
400
  \ConstantTok{R}\AttributeTok{.theme\_set}\NormalTok{(}\ConstantTok{R}\AttributeTok{.theme\_bw}\NormalTok{) }\CommentTok{\# pre{-}set the bw theme.}
340
401
 
341
- \NormalTok{midwest }\OperatorTok{=} \OperatorTok{\textasciitilde{}}\WarningTok{:midwest}
402
+ \NormalTok{midwest }\OperatorTok{=} \OperatorTok{\textasciitilde{}}\ConstantTok{R}\KeywordTok{[}\WarningTok{:midwest}\KeywordTok{]}
342
403
 
343
404
  \CommentTok{\# Scatterplot}
344
405
  \NormalTok{gg }\OperatorTok{=}\NormalTok{ midwest}\AttributeTok{.ggplot}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{x:} \WarningTok{:area}\NormalTok{, }\WarningTok{y:} \WarningTok{:poptotal}\NormalTok{)) }\OperatorTok{+}
@@ -356,7 +417,7 @@ the screen, use the R.awt device, as commented on the code.
356
417
  \end{Highlighting}
357
418
  \end{Shaded}
358
419
 
359
- \pandocbounded{\includegraphics[keepaspectratio]{galaaz_ggplot_files/figure-latex/midwest_rb.pdf}}
420
+ \pandocbounded{\includegraphics[keepaspectratio]{galaaz_ggplot_files/galaaz_ggplot_files/figure-latex/midwest_rb.pdf}}
360
421
 
361
422
  In R, the code to generate this plot is the following
362
423
 
@@ -428,38 +489,43 @@ notation and the preferred color is blue.
428
489
  \begin{Highlighting}[]
429
490
  \CommentTok{\# corp\_theme.rb}
430
491
  \CommentTok{\# defines the corporate theme for all plots}
431
-
492
+
432
493
  \ControlFlowTok{module} \DataTypeTok{CorpTheme}
433
494
 
434
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
435
- \CommentTok{\# Defines the plot theme (visualization). In this theme we remove major and minor}
436
- \CommentTok{\# grids, borders and background. We also turn{-}off scientific notation.}
437
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
438
-
495
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
496
+ \CommentTok{\# Plot theme: no major/minor grids, borders, or background;}
497
+ \CommentTok{\# turn off scientific notation.}
498
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
499
+
439
500
  \ControlFlowTok{def} \DecValTok{self}\AttributeTok{.global\_theme}
440
-
501
+
441
502
  \ConstantTok{R}\AttributeTok{.options}\NormalTok{(}\WarningTok{scipen:} \DecValTok{999}\NormalTok{) }\CommentTok{\# turn{-}off scientific notation like 1e+48}
442
-
503
+
443
504
  \CommentTok{\# remove major grids}
444
- \NormalTok{ global\_theme }\OperatorTok{=} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_major:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{())}
505
+ \NormalTok{ global\_theme }\OperatorTok{=}
506
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_major:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{())}
445
507
  \CommentTok{\# remove minor grids}
446
- \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_minor:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
508
+ \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+}
509
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_grid\_\_minor:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
447
510
  \CommentTok{\# remove border}
448
- \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_border:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
511
+ \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+}
512
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_border:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
449
513
  \CommentTok{\# remove background}
450
- \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+} \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_background:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
514
+ \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+}
515
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{panel\_\_background:} \ConstantTok{E}\AttributeTok{.element\_blank}\NormalTok{)}
451
516
  \CommentTok{\# Change axis font}
452
517
  \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+}
453
- \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_text:} \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}\WarningTok{size:} \DecValTok{8}\NormalTok{, }\WarningTok{color:} \StringTok{"\#000080"}\NormalTok{))}
518
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_text:} \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}
519
+ \WarningTok{size:} \DecValTok{8}\NormalTok{, }\WarningTok{color:} \StringTok{"\#000080"}\NormalTok{))}
454
520
  \CommentTok{\# change color of axis titles}
455
521
  \NormalTok{ global\_theme }\OperatorTok{=}\NormalTok{ global\_theme }\OperatorTok{+}
456
- \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_title:} \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}
457
- \WarningTok{color:} \StringTok{"\#000080"}\NormalTok{, }
458
- \WarningTok{face:} \StringTok{"bold"}\NormalTok{,}
459
- \WarningTok{size:} \DecValTok{8}\NormalTok{,}
460
- \WarningTok{hjust:} \DecValTok{1}\NormalTok{))}
522
+ \ConstantTok{R}\AttributeTok{.theme}\NormalTok{(}\WarningTok{axis\_\_title:} \ConstantTok{E}\AttributeTok{.element\_text}\NormalTok{(}
523
+ \WarningTok{color:} \StringTok{"\#000080"}\NormalTok{,}
524
+ \WarningTok{face:} \StringTok{"bold"}\NormalTok{,}
525
+ \WarningTok{size:} \DecValTok{8}\NormalTok{,}
526
+ \WarningTok{hjust:} \DecValTok{1}\NormalTok{))}
461
527
  \ControlFlowTok{end}
462
-
528
+
463
529
  \ControlFlowTok{end}
464
530
  \end{Highlighting}
465
531
  \end{Shaded}
@@ -470,7 +536,7 @@ We now define a ScatterPlot class:
470
536
  \begin{Highlighting}[]
471
537
  \CommentTok{\# ScatterPlot.rb}
472
538
  \CommentTok{\# creates a scatter plot and allow some configuration}
473
-
539
+
474
540
  \ControlFlowTok{class} \DataTypeTok{ScatterPlot}
475
541
 
476
542
  \OtherTok{attr\_accessor} \WarningTok{:title}
@@ -478,55 +544,55 @@ We now define a ScatterPlot class:
478
544
  \OtherTok{attr\_accessor} \WarningTok{:caption}
479
545
  \OtherTok{attr\_accessor} \WarningTok{:x\_label}
480
546
  \OtherTok{attr\_accessor} \WarningTok{:y\_label}
481
-
482
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
547
+
548
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
483
549
  \CommentTok{\# Initialize the plot with the data and the x and y variables}
484
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
550
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
485
551
 
486
552
  \ControlFlowTok{def}\NormalTok{ initialize(data, x}\OperatorTok{:}\NormalTok{, }\WarningTok{y:}\NormalTok{)}
487
553
  \OtherTok{@data} \OperatorTok{=}\NormalTok{ data}
488
554
  \OtherTok{@x} \OperatorTok{=}\NormalTok{ x}
489
555
  \OtherTok{@y} \OperatorTok{=}\NormalTok{ y}
490
556
  \ControlFlowTok{end}
491
-
492
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
557
+
558
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
493
559
  \CommentTok{\# Define groupings by color and size}
494
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
560
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
495
561
 
496
562
  \ControlFlowTok{def}\NormalTok{ group\_by(color}\OperatorTok{:}\NormalTok{, }\WarningTok{size:}\NormalTok{)}
497
563
  \OtherTok{@color\_by} \OperatorTok{=}\NormalTok{ color}
498
564
  \OtherTok{@size\_by} \OperatorTok{=}\NormalTok{ size}
499
565
  \ControlFlowTok{end}
500
566
 
501
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
502
- \CommentTok{\# Add a smoothing line, and if confidence is true the add a confidence interval, if}
503
- \CommentTok{\# false does not add the confidence interval}
504
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
567
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
568
+ \CommentTok{\# Add a smoothing line; confidence: true draws a CI band.}
569
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
505
570
 
506
571
  \ControlFlowTok{def}\NormalTok{ add\_smoothing\_line(method}\OperatorTok{:}\NormalTok{, }\WarningTok{confidence:} \DecValTok{true}\NormalTok{)}
507
572
  \OtherTok{@method} \OperatorTok{=}\NormalTok{ method}
508
573
  \OtherTok{@confidence} \OperatorTok{=}\NormalTok{ confidence}
509
574
  \ControlFlowTok{end}
510
-
511
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
512
- \CommentTok{\# Creates the graph title, properly formated for this theme}
513
- \CommentTok{\# @param title [String] The title to add to the graph}
514
- \CommentTok{\# @return textGrob that can be included in a graph}
515
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
516
-
517
- \ControlFlowTok{def}\NormalTok{ graph\_params(title}\OperatorTok{:} \StringTok{""}\NormalTok{, }\WarningTok{subtitle:} \StringTok{""}\NormalTok{, }\WarningTok{caption:} \StringTok{""}\NormalTok{, }\WarningTok{x\_label:} \StringTok{""}\NormalTok{, }\WarningTok{y\_label:} \StringTok{""}\NormalTok{)}
575
+
576
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
577
+ \CommentTok{\# Graph title / labels, formatted for this theme.}
578
+ \CommentTok{\# @param title [String] title to add to the graph}
579
+ \CommentTok{\# @return labs() result that can be included in a graph}
580
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
581
+
582
+ \ControlFlowTok{def}\NormalTok{ graph\_params(title}\OperatorTok{:} \StringTok{""}\NormalTok{, }\WarningTok{subtitle:} \StringTok{""}\NormalTok{, }\WarningTok{caption:} \StringTok{""}\NormalTok{,}
583
+ \WarningTok{x\_label:} \StringTok{""}\NormalTok{, }\WarningTok{y\_label:} \StringTok{""}\NormalTok{)}
518
584
  \ConstantTok{R}\AttributeTok{.labs}\NormalTok{(}
519
- \WarningTok{title:}\NormalTok{ title, }
520
- \WarningTok{subtitle:}\NormalTok{ subtitle, }
585
+ \WarningTok{title:}\NormalTok{ title,}
586
+ \WarningTok{subtitle:}\NormalTok{ subtitle,}
521
587
  \WarningTok{caption:}\NormalTok{ caption,}
522
- \WarningTok{y\_label:}\NormalTok{ y\_label, }
523
- \WarningTok{x\_label:}\NormalTok{ x\_label, }
588
+ \WarningTok{y\_label:}\NormalTok{ y\_label,}
589
+ \WarningTok{x\_label:}\NormalTok{ x\_label,}
524
590
  \NormalTok{ )}
525
591
  \ControlFlowTok{end}
526
592
 
527
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
593
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
528
594
  \CommentTok{\# Prepare the plot\textquotesingle{}s points}
529
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
595
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
530
596
 
531
597
  \ControlFlowTok{def}\NormalTok{ points}
532
598
  \NormalTok{ params }\OperatorTok{=} \OperatorTok{\{\}}
@@ -534,28 +600,27 @@ We now define a ScatterPlot class:
534
600
  \NormalTok{ params}\KeywordTok{[}\WarningTok{:size}\KeywordTok{]} \OperatorTok{=} \OtherTok{@size\_by} \ControlFlowTok{if} \OtherTok{@size\_by}
535
601
  \ConstantTok{R}\AttributeTok{.geom\_point}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(params))}
536
602
  \ControlFlowTok{end}
537
-
538
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
603
+
604
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
539
605
  \CommentTok{\# Plots the scatterplot}
540
- \CommentTok{\#{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
606
+ \CommentTok{\# {-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}{-}}
541
607
 
542
608
  \ControlFlowTok{def}\NormalTok{ plot}
543
609
  \NormalTok{ gg }\OperatorTok{=} \OtherTok{@data}\AttributeTok{.ggplot}\NormalTok{(}\ConstantTok{E}\AttributeTok{.aes}\NormalTok{(}\WarningTok{x:} \OtherTok{@x}\NormalTok{, }\WarningTok{y:} \OtherTok{@y}\NormalTok{)) }\OperatorTok{+}
544
- \NormalTok{ points }\OperatorTok{+}
610
+ \NormalTok{ points }\OperatorTok{+}
545
611
  \ConstantTok{R}\AttributeTok{.geom\_smooth}\NormalTok{(}\WarningTok{method:} \OtherTok{@method}\NormalTok{, }\WarningTok{se:} \OtherTok{@confidence}\NormalTok{) }\OperatorTok{+}
546
612
  \ConstantTok{R}\AttributeTok{.xlim}\NormalTok{(}\ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\FloatTok{0.1}\NormalTok{)) }\OperatorTok{+}
547
- \ConstantTok{R}\AttributeTok{.ylim}\NormalTok{(}\ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\DecValTok{500000}\NormalTok{)) }\OperatorTok{+}
613
+ \ConstantTok{R}\AttributeTok{.ylim}\NormalTok{(}\ConstantTok{R}\AttributeTok{.c}\NormalTok{(}\DecValTok{0}\NormalTok{, }\DecValTok{500000}\NormalTok{)) }\OperatorTok{+}
548
614
  \NormalTok{ graph\_params(}\WarningTok{title:} \OtherTok{@title}\NormalTok{,}
549
- \WarningTok{subtitle:} \OtherTok{@subtitle}\NormalTok{, }
550
- \WarningTok{y\_label:} \OtherTok{@y\_label}\NormalTok{, }
551
- \WarningTok{x\_label:} \OtherTok{@x\_label}\NormalTok{, }
615
+ \WarningTok{subtitle:} \OtherTok{@subtitle}\NormalTok{,}
616
+ \WarningTok{y\_label:} \OtherTok{@y\_label}\NormalTok{,}
617
+ \WarningTok{x\_label:} \OtherTok{@x\_label}\NormalTok{,}
552
618
  \WarningTok{caption:} \OtherTok{@caption}\NormalTok{) }\OperatorTok{+}
553
619
  \DataTypeTok{CorpTheme}\AttributeTok{.global\_theme}
554
620
 
555
621
  \FunctionTok{puts}\NormalTok{ gg}
556
-
557
622
  \ControlFlowTok{end}
558
-
623
+
559
624
  \ControlFlowTok{end}
560
625
  \end{Highlighting}
561
626
  \end{Shaded}
@@ -568,29 +633,31 @@ data
568
633
  \FunctionTok{require} \VerbatimStringTok{\textquotesingle{}galaaz\textquotesingle{}}
569
634
  \FunctionTok{require} \VerbatimStringTok{\textquotesingle{}ggplot\textquotesingle{}}
570
635
 
571
- \NormalTok{sp }\OperatorTok{=} \DataTypeTok{ScatterPlot}\AttributeTok{.new}\NormalTok{(}\OperatorTok{\textasciitilde{}}\WarningTok{:midwest}\NormalTok{, }\WarningTok{x:} \WarningTok{:area}\NormalTok{, }\WarningTok{y:} \WarningTok{:poptotal}\NormalTok{)}
636
+ \NormalTok{sp }\OperatorTok{=} \DataTypeTok{ScatterPlot}\AttributeTok{.new}\NormalTok{(}\OperatorTok{\textasciitilde{}}\ConstantTok{R}\KeywordTok{[}\WarningTok{:midwest}\KeywordTok{]}\NormalTok{, }\WarningTok{x:} \WarningTok{:area}\NormalTok{, }\WarningTok{y:} \WarningTok{:poptotal}\NormalTok{)}
572
637
  \NormalTok{sp}\AttributeTok{.title} \OperatorTok{=} \StringTok{"Midwest Dataset {-} Scatterplot"}
573
638
  \NormalTok{sp}\AttributeTok{.subtitle} \OperatorTok{=} \StringTok{"Area Vs Population"}
574
639
  \NormalTok{sp}\AttributeTok{.caption} \OperatorTok{=} \StringTok{"Source: midwest"}
575
640
  \NormalTok{sp}\AttributeTok{.x\_label} \OperatorTok{=} \StringTok{"Area"}
576
641
  \NormalTok{sp}\AttributeTok{.y\_label} \OperatorTok{=} \StringTok{"Population"}
577
- \NormalTok{sp}\AttributeTok{.group\_by}\NormalTok{(}\WarningTok{color:} \WarningTok{:state}\NormalTok{, }\WarningTok{size:} \WarningTok{:popdensity}\NormalTok{) }\CommentTok{\# try sp.group\_by(color: :state)}
642
+ \CommentTok{\# try: sp.group\_by(color: :state)}
643
+ \NormalTok{sp}\AttributeTok{.group\_by}\NormalTok{(}\WarningTok{color:} \WarningTok{:state}\NormalTok{, }\WarningTok{size:} \WarningTok{:popdensity}\NormalTok{)}
578
644
  \CommentTok{\# available methods: "lm", "glm", "loess", "gam"}
579
- \NormalTok{sp}\AttributeTok{.add\_smoothing\_line}\NormalTok{(}\WarningTok{method:} \StringTok{"glm"}\NormalTok{) }
645
+ \NormalTok{sp}\AttributeTok{.add\_smoothing\_line}\NormalTok{(}\WarningTok{method:} \StringTok{"glm"}\NormalTok{)}
580
646
  \NormalTok{sp}\AttributeTok{.plot}
581
647
  \end{Highlighting}
582
648
  \end{Shaded}
583
649
 
584
- \pandocbounded{\includegraphics[keepaspectratio]{galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf}}
650
+ \pandocbounded{\includegraphics[keepaspectratio]{galaaz_ggplot_files/galaaz_ggplot_files/figure-latex/scatter_plot_rb.pdf}}
585
651
 
586
652
  \section{Conclusion}\label{conclusion}
587
653
 
588
654
  R is a very powerful language for statistical analysis, data analytics,
589
655
  machine learning, plotting and many other scientific applications with a
590
656
  very large package ecosystem. However R is often considered hard to
591
- learn and lacking modern computer languages constructs such as object
592
- oriented classes, modules, lambdas, etc. For this reason, many
593
- developers have started or switched from R to Python.
657
+ learn and lacking modern language features such as object-oriented
658
+ classes, modules, and first-class functions. For that reason, many teams
659
+ have standardized on Python (or stayed entirely inside R) rather than
660
+ mixing ecosystems.
594
661
 
595
662
  With Galaaz, R programmers can almost transparently migrate from R to
596
663
  Ruby, since syntax is almost identical and \textbf{GNU R} remains the
@@ -601,7 +668,8 @@ libraries that nicely complement R packages.
601
668
  For the Ruby developer, Galaaz allows the immediate use of R functions
602
669
  with minimal ceremony. As shown in the second example above, class
603
670
  \texttt{ScatterPlot} hides most R call details from the Ruby developer.
604
- \textbf{JRuby} provides \textbf{real parallel threads} on the Ruby side
605
- and access to the JVM ecosystem when you need it.
671
+ Prefer \textbf{JRuby} when you want \textbf{real parallel threads} on
672
+ the Ruby side and access to the JVM ecosystem; \textbf{CRuby} works
673
+ equally for the Galaaz bridge itself.
606
674
 
607
675
  \end{document}