11---
22# title: tinyplot
3- # subtitle: Lightweight extension of the base R graphics system
4- # format: clean-revealjs
53title : " <br/><br/><br/>"
64subtitle : Lightweight extension of the base R graphics system
75format :
86 clean-revealjs :
97 title-slide-attributes :
108 data-background-image : " img/background.png"
11- # clean-revealjs:
12- # # logo: img/logo.svg
13- # title-slide-attributes:
14- # data-background-image: "img/background.png"
9+ data-background-size : contain
1510execute :
1611 echo : true
1712author :
@@ -270,19 +265,24 @@ But going beyond the defaults is often (much) more work that I want to do.
270265
271266### R has two low-level graphics systems
272267
273- ::: {.r-stack}
274- ![ Note: Adapted from @murrell2023updates .] ( img/rgraphics.png )
268+ ![ ] ( img/rgraphics.png )
275269
276- ![ Note: Adapted from @murrell2023updates .] ( img/rgraphics2.png ) {.fragment}
277- :::
270+ ## grid vs graphics (redux) {visibility="uncounted" auto-animate=true}
278271
272+ ### R has two low-level graphics systems
273+
274+ ![ ] ( img/rgraphics2.png )
275+
276+ ## grid vs graphics (redux) {visibility="uncounted" auto-animate=true}
277+
278+ ### R has two low-level graphics systems
279+
280+ ![ ] ( img/rgraphics2.png )
279281
280- ::: {.fragment}
281282** tinyplot** goals:
282283
2832841 . Make base R graphics more user-friendly.
284- 2 . Improved feature parity vs. grid-based 📦s like ** ggplot2** and ** lattice** .
285- :::
285+ 2 . Improved feature parity vs. grid-based 📦s like ** ggplot2** and ** lattice** .
286286
287287## Origin story 🤝
288288
@@ -523,19 +523,25 @@ plt(
523523## tinyplot API
524524### types
525525
526- All tinyplot types can be passed as either a:
526+ tinyplot types can be passed as either a _ string _ or _ function _ :
527527
528- - _ string_ (` "p" ` , ` "density ` , ` "lm" ` , ...), or
529- - _ function_ (` type_points() ` , ` type_density() ` , ` type_lm() ` , ...)
528+ | | | | | |
529+ | -----| :----| :----| :----| :----|
530+ | _ string_ | ` "p" ` | ` "density" ` | ` "lm" ` | ` "<name>" ` |
531+ | _ function_ | ` type_points() ` | ` type_density() ` | ` type_lm() ` | ` type_<name>() ` |
530532
531- In general, the functional equivalents are denoted ` type_*() ` and support direct argument passing for customization, e.g.
533+ \
534+
535+ ::: {.fragment}
536+ The function variants all take the form ` type_<name> ` and support type-specific
537+ argument passing for customization, e.g.
532538
533539``` {r}
534- ?type_lm
535- args (type_lm)
540+ # ?type_lm # full documentation
541+ str (type_lm) # available args
536542```
537- ::: {.callout-note}
538- Custom args can also be passed through ` plt(...) ` , so long as there isn't a top-level clash.
543+
544+ P.S. Type args can also be passed via ` plt(...) ` _ if _ there's no top-level clash.
539545:::
540546
541547## tinyplot API
821827#| fig-width: 6
822828#| fig-asp: 1
823829
824- mod = lm(body_mass ~ species + sex ,
825- data = penguins )
830+ mod = lm(weight ~ 0 + Time + Diet ,
831+ data = ChickWeight )
826832coefs = data.frame(
827833 names(coef(mod)),
828834 coef(mod),
@@ -898,6 +904,11 @@ plt(Month ~ Temp | Temp,
898904)
899905```
900906
907+ ``` {r}
908+ #| include: false
909+ tinytheme()
910+ ```
911+
901912# Conclusions
902913
903914## Advantages of tinyplot {#sec-adv}
@@ -920,7 +931,7 @@ For the longer version: [[tinyplot pros]{.button}](#sec-pros)
920931- Custom layout
921932- Missing features
922933
923- For the longer version: [[ tinyplot pros ] {.button}] ( #sec-cons )
934+ For the longer version: [[ tinyplot cons ] {.button}] ( #sec-cons )
924935
925936## Acknowledgements
926937
@@ -966,17 +977,17 @@ Many other contributors, feedback providers, and a sources of inspiration.
966977::: {#refs}
967978:::
968979
969- # Bonus: Tinyplot pros {#sec-pros}
980+ # Bonus: Tinyplot pros {#sec-pros visibility="uncounted" }
970981
971- ## Concise
982+ ## Concise {visibility="uncounted"}
972983
973984### The formula API gives bang for buck
974985
975986![ ] ( img/briggs.png )
976987
977988_ P.S. Thanks to Ryan for letting me use this screenshot._
978989
979- ## Concise
990+ ## Concise {visibility="uncounted"}
980991
981992### The formula API gives bang for buck
982993
@@ -1018,7 +1029,7 @@ plt(
10181029
10191030_ (That's about 1/3 fewer characters.)_
10201031
1021- ## Concise
1032+ ## Concise {visibility="uncounted"}
10221033
10231034### Concision is even starker vs. vanilla base plot
10241035
@@ -1044,7 +1055,7 @@ Adapted from @viechtbauer2025tinyplot.
10441055
10451056::::
10461057
1047- ## Lightweight
1058+ ## Lightweight {visibility="uncounted"}
10481059
10491060### Base R only
10501061
@@ -1063,9 +1074,9 @@ Very fast to install and play with in webR / WebAssembly. ([Try it!](https://web
10631074[[ Back to main] {.button}] ( #sec-adv )
10641075
10651076
1066- # Bonus: Tinyplot cons {#sec-cons}
1077+ # Bonus: Tinyplot cons {#sec-cons visibility="uncounted" }
10671078
1068- ## Layering gotchas
1079+ ## Layering gotchas {visibility="uncounted"}
10691080
10701081### Scaling is fixed by the first layer
10711082
@@ -1078,7 +1089,7 @@ plt_add(type = "lm")
10781089This is a limitation of ** graphics** "canvas" logic. (Workarounds: Change layer order, or use ` x/ylim ` .)
10791090:::
10801091
1081- ## Layering gotchas
1092+ ## Layering gotchas {visibility="uncounted"}
10821093
10831094### Can't combine ` file ` with ` plt_add ` (yet)
10841095
@@ -1096,18 +1107,16 @@ I'm hoping to provide a native solution in the future, but workarounds for now:
10961107- Open/close the appropriate graphics device manually, e.g. ` png("myplot.png"); plt(...); plt_add(...); dev.off() `
10971108:::
10981109
1099- ## Missing features
1110+ ## Missing features {visibility="uncounted"}
11001111
11011112I hope that I have convinced you that ** tinyplot** covers a _ lot_ of ground.
11021113
11031114- The API should also be very stable. I expect few (if any) breaking changes from here on out.
11041115
1105- ::: {.fragment}
11061116Still, ** tinyplot** is a relatively young project and there are some features and plot types that we don't support (yet). Some things coming down the pike:
11071117
11081118- bubble plots ([ #433 ] ( https://github.com/grantmcdermott/tinyplot/pull/433 ) )
11091119- dodged elements ([ #406 ] ( https://github.com/grantmcdermott/tinyplot/issues/406 ) )
11101120- maps ([ #210 ] ( https://github.com/grantmcdermott/tinyplot/issues/210 ) )
1111- :::
11121121
11131122[[ Back to main] {.button}] ( #sec-disadv )
0 commit comments