-
-
Notifications
You must be signed in to change notification settings - Fork 81
/
graphics.Rmd
74 lines (62 loc) · 1.2 KB
/
graphics.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
title: "Graphics"
author: "John Coene"
date: "`r Sys.Date()`"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{Graphics}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>"
)
library(echarts4r)
e_common(
font_family = "Raleway"
)
```
With `echarts4r` comes a small but powerful low level API to graphic elements.
## Functions
Graphic functions end in `_g`
- `g_graphic_g` (initialisation)
- `g_group_g`
- `g_image_g`
- `g_text_g`
- `g_rect_g`
- `g_circle_g`
- `g_ring_g`
- `g_sector_g`
- `g_arc_g`
- `g_polygon_g`
- `g_polyline_g`
- `g_line_g`
- `g_bezier_curve_g`
## Draft
The `e_draft` helper function is a very simple wrapper aroudn the graphics API and thus a good example of what can be achieved.
```{r}
cars |>
e_charts(speed) |>
e_scatter(dist) |>
e_draft()
```
## Image
You can add an image for instance.
```{r}
cars |>
e_charts(speed) |>
e_scatter(dist) |>
e_image_g(
right = 20,
top = 20,
z = -999,
style = list(
image = "https://www.r-project.org/logo/Rlogo.png",
width = 150,
height = 150,
opacity = .6
)
)
```