2024/12/07 Japan.R 2024
I usually don’t say these words.
I’m fine if it’s decently fast. But…
If one plot takes 0.1s, a 10s of animation at 60fps will take…
\[ 0.1 \times 10 \times 60 = 1 [\texttt{minutes}] \]
One minute for every single tweak on one of the many parameters!??
png()pdf()ragg::agg_png()svglite::svglite()Even if you don’t know the word, most of you probably know how to use it.
Draw a line:
Draw a text:
rect() APIrect() APIrect() APIcircle() APIcircle() APIcircle() APIcircle() APIcircle() APIpolyline() APIpolyline() APIpolyline() APIpolyline() APIpolyline() APIpolyline() APItextUTF8() APItextUTF8() APItextUTF8() APItextUTF8() APItextUTF8() APILet’s measure!
A simple example code taken from ggplot2’s README:
The elapsed times of API calls:
...::size: 302 times (0.471 ms)
...::circle: 241 times (0.100 ms)
...::text_width: 48 times (0.084 ms)
...::char_metric: 31 times (0.081 ms)
...::activate: 1 times (0.035 ms)
...::text: 19 times (0.034 ms)
...::polyline: 28 times (0.021 ms)
...::new_page: 1 times (0.007 ms)
...::rect: 10 times (0.004 ms)
The elapsed times of API calls:
...::size: 302 times (0.471 ms)
...::circle: 241 times (0.100 ms)
...::text_width: 48 times (0.084 ms)
...::char_metric: 31 times (0.081 ms)
...::activate: 1 times (0.035 ms)
...::text: 19 times (0.034 ms)
...::polyline: 28 times (0.021 ms)
...::new_page: 1 times (0.007 ms)
...::rect: 10 times (0.004 ms)
Total time:
724.536 ms

“in theory”
= I don’t implement it yet :P
grid::grid.bezier() can draw a bezier curve by flattening the curve to small lines