/
geom-contour-filled-z.Rmd
98 lines (61 loc) · 1.92 KB
/
geom-contour-filled-z.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
75
76
77
78
79
80
81
82
---
title: "geom_contour_filled_z"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{geom_contour_filled_z}
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = FALSE,
comment = "#>",
fig.width = 8,
fig.height = 6
)
```
```{r setup, message = FALSE}
library(rgl)
library(devout)
library(devoutrgl)
library(ggrgl)
library(ggplot2)
library(dplyr)
```
`geom_contour_filled_z()`
-----------------------------------------------------------------------------
```{r}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Create plot with `geom_contour_filled_z()`
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
p <- ggplot(faithfuld) +
geom_contour_filled_z(aes(waiting, eruptions, z = density),
extrude = TRUE, extrude_face_fill = 'grey20') +
theme_ggrgl() +
labs(
title = "ggrgl::geom_contour_filled_z()",
subtitle = "with {devoutrgl}"
)
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Render Plot in 3d with {devoutrgl}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devoutrgl::rgldev(fov = 30, view_angle = -30)
p
invisible(dev.off())
```
**Use your mouse, mouse buttons and scrollwheel to manipulate the 3d plot**
```{r echo=FALSE}
if (!interactive()) rgl::rglwidget()
```
```{r echo=FALSE, eval=FALSE}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Saving Example Image.
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
devoutrgl::rgldev(fov = 30, view_angle = -30, zscale = 3,
file = "man/figures/examples/geom-contour-filled-z.png", close_window = TRUE, dpi = 200)
p
dev.off()
```
```{r eval=FALSE, echo=FALSE}
devoutrgl::save_animated_scene(gif_name = "man/figures/anim1.gif")
```