Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 343283a

Browse files
committed
Update 2021-08-04-splom.Rmd
1 parent b871583 commit 343283a

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

ggplot2/2021-08-04-splom.Rmd

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ Scatterplots of each pair of numeric variable are drawn on the left part of the
2626
```{r}
2727
library(plotly)
2828
library(GGally)
29-
30-
data <- data.frame( var1 = 1:100 + rnorm(100,sd=20), v2 = 1:100 + rnorm(100,sd=27), v3 = rep(1, 100) + rnorm(100, sd = 1))
31-
data$v4 = data$var1 ** 2
32-
data$v5 = -(data$var1 ** 2)
33-
34-
p <- ggpairs(data, title="correlogram with ggpairs()")
29+
30+
data <- data.frame( var1 = 1:100 + rnorm(100,sd=20), v2 = 1:100 + rnorm(100,sd=27), v3 = rep(1, 100) + rnorm(100, sd = 1))
31+
data$v4 = data$var1 ** 2
32+
data$v5 = -(data$var1 ** 2)
33+
34+
p <- ggpairs(data, title="correlogram with ggpairs()")
3535
3636
ggplotly(p)
3737
```
@@ -46,14 +46,14 @@ he `ggcorr()` function allows to visualize the correlation of each pair of varia
4646
```{r}
4747
library(plotly)
4848
library(GGally)
49-
50-
data <- data.frame( var1 = 1:100 + rnorm(100,sd=20), v2 = 1:100 + rnorm(100,sd=27), v3 = rep(1, 100) + rnorm(100, sd = 1))
51-
data$v4 = data$var1 ** 2
52-
data$v5 = -(data$var1 ** 2)
53-
54-
p <- ggcorr(data, method = c("everything", "pearson"))
55-
56-
p
49+
50+
data <- data.frame( var1 = 1:100 + rnorm(100,sd=20), v2 = 1:100 + rnorm(100,sd=27), v3 = rep(1, 100) + rnorm(100, sd = 1))
51+
data$v4 = data$var1 ** 2
52+
data$v5 = -(data$var1 ** 2)
53+
54+
p <- ggcorr(data, method = c("everything", "pearson"))
55+
56+
ggplotly(p)
5757
```
5858

5959
<!--------------------- EXAMPLE BREAK ------------------------->
@@ -64,10 +64,10 @@ It is possible to use `ggplot2` aesthetics on the chart, for instance to color e
6464
```{r}
6565
library(plotly)
6666
library(GGally)
67-
67+
6868
data(flea)
6969
70-
p <- ggpairs(flea, columns = 2:4, ggplot2::aes(colour=species))
70+
p <- ggpairs(flea, columns = 2:4, ggplot2::aes(colour=species))
7171
7272
ggplotly(p)
7373
```
@@ -82,7 +82,7 @@ Change the type of plot used on each part of the `correlogram`. This is done wit
8282
```{r}
8383
library(plotly)
8484
library(GGally)
85-
85+
8686
data(tips, package = "reshape")
8787
8888
p <- ggpairs(
@@ -91,7 +91,7 @@ p <- ggpairs(
9191
lower = list(continuous = "points", combo = "dot_no_facet")
9292
)
9393
94-
p
94+
ggplotly(p)
9595
```
9696

9797
<!--------------------- EXAMPLE BREAK ------------------------->

0 commit comments

Comments
 (0)