Skip to content

Commit 4f015cb

Browse files
committed
Add missing conditional execution of 'ggrepel'
An object was created in a chunk run only with 'ggrepel' available, but used in unprotected chunks. In addition found additional unprotected chunks calling 'ggrepel'.
1 parent 79c84aa commit 4f015cb

6 files changed

+399
-402
lines changed

DESCRIPTION

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Package: ggpp
22
Type: Package
33
Title: Grammar Extensions to 'ggplot2'
4-
Version: 0.5.8
5-
Date: 2024-06-26
4+
Version: 0.5.8-1
5+
Date: 2024-06-30
66
Authors@R:
77
c(
88
person("Pedro J.", "Aphalo", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3385-972X")),

NEWS.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ editor_options:
66
wrap: 72
77
---
88

9-
# ggpp 0.5.8
9+
# ggpp 0.5.8-1
1010

1111
- Fix wrong test for availability of 'gginnards' in examples (reported by
1212
_Joshua Ulrich_ in issue #53).
13+
- Add to vignette _Combining repulsion and nudging_ three missing tests for
14+
availability of package 'ggrepel'.
1315
- Revise `position_nudge_to()` to support expansion and contraction of the
1416
range within which to spread the positions.
1517

man/ggpp-package.Rd

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vignettes/nudge-examples.R

+5-7
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ ggplot(df, aes(x, y, label = l)) +
5555
hjust = "left") +
5656
expand_limits(x = 2.3)
5757

58-
## ----eval=eval_ggrepel--------------------------------------------------------
58+
## -----------------------------------------------------------------------------
5959
## Example data frame where each species' principal components have been computed.
6060
df1 <- data.frame(
6161
Species = paste("Species",1:5),
6262
PC1 = c(-4, -3.5, 1, 2, 3),
6363
PC2 = c(-1, -1, 0, -0.5, 0.7))
6464

65+
## ----eval=eval_ggrepel--------------------------------------------------------
6566
ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
6667
geom_hline(aes(yintercept = 0), linewidth = .2) +
6768
geom_vline(aes(xintercept = 0), linewidth = .2) +
@@ -78,7 +79,7 @@ ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
7879
coord_fixed() +
7980
theme(legend.position = "none")
8081

81-
## -----------------------------------------------------------------------------
82+
## ----eval=eval_ggrepel--------------------------------------------------------
8283
ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
8384
geom_hline(aes(yintercept = 0), linewidth = .2) +
8485
geom_vline(aes(xintercept = 0), linewidth = .2) +
@@ -350,14 +351,11 @@ ggplot(data = d, aes(x, y, label = lab, colour = group)) +
350351
geom_point()
351352

352353
## -----------------------------------------------------------------------------
353-
library(ggplot2)
354-
library(ggpp)
355-
library(ggrepel)
356354
syms = c(letters[1:5], LETTERS[1:5], 0:9)
357355
labs = do.call(paste0, expand.grid(syms, syms))
358356
dset = data.frame(x=rnorm(1e3), y=rnorm(1e3), label=sample(labs, 1e3, replace=TRUE))
359357

360-
## -----------------------------------------------------------------------------
358+
## ----eval=eval_ggrepel--------------------------------------------------------
361359
ggplot(dset, aes(x=x, y=y, label = label)) +
362360
geom_point(colour = "grey85") +
363361
stat_dens2d_filter(geom = "text_repel",
@@ -466,7 +464,7 @@ ggplot(df, aes(x, yy)) +
466464
box.padding = 0,
467465
min.segment.length = 0)
468466

469-
## -----------------------------------------------------------------------------
467+
## ----eval=eval_ggrepel--------------------------------------------------------
470468
ggplot(df, aes(x, yy)) +
471469
geom_point() +
472470
stat_smooth(method = "lm",

vignettes/nudge-examples.Rmd

+7-8
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,18 @@ respective default justification approaches.
243243

244244
---
245245

246-
A usually more problematic example is the labeling of loadings in PCA
246+
A usually more problematic example is the labelling of loadings in PCA
247247
and similar biplots.
248248

249-
```{r, eval=eval_ggrepel}
249+
```{r}
250250
## Example data frame where each species' principal components have been computed.
251251
df1 <- data.frame(
252252
Species = paste("Species",1:5),
253253
PC1 = c(-4, -3.5, 1, 2, 3),
254254
PC2 = c(-1, -1, 0, -0.5, 0.7))
255+
```
255256

257+
```{r, eval=eval_ggrepel}
256258
ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
257259
geom_hline(aes(yintercept = 0), linewidth = .2) +
258260
geom_vline(aes(xintercept = 0), linewidth = .2) +
@@ -273,7 +275,7 @@ ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
273275
The use of `position_nudge_center()` together with repulsion, shown above,
274276
results a much better plot than using only repulsion.
275277

276-
```{r}
278+
```{r, eval=eval_ggrepel}
277279
ggplot(df1, aes(x=PC1, y = PC2, label = Species, colour = Species)) +
278280
geom_hline(aes(yintercept = 0), linewidth = .2) +
279281
geom_vline(aes(xintercept = 0), linewidth = .2) +
@@ -696,15 +698,12 @@ GitHub by Michael Schubert, made possible by parameter `keep.these` added for
696698
this and similar use cases.
697699

698700
```{r}
699-
library(ggplot2)
700-
library(ggpp)
701-
library(ggrepel)
702701
syms = c(letters[1:5], LETTERS[1:5], 0:9)
703702
labs = do.call(paste0, expand.grid(syms, syms))
704703
dset = data.frame(x=rnorm(1e3), y=rnorm(1e3), label=sample(labs, 1e3, replace=TRUE))
705704
```
706705

707-
```{r}
706+
```{r, eval=eval_ggrepel}
708707
ggplot(dset, aes(x=x, y=y, label = label)) +
709708
geom_point(colour = "grey85") +
710709
stat_dens2d_filter(geom = "text_repel",
@@ -909,7 +908,7 @@ Nudging plus repulsion, shown next, will be compared to
909908
alternatives. In this case we assume no linking segments are desired as
910909
there is enough space for the data labels to remain near the observations.
911910

912-
```{r}
911+
```{r, eval=eval_ggrepel}
913912
ggplot(df, aes(x, yy)) +
914913
geom_point() +
915914
stat_smooth(method = "lm",

0 commit comments

Comments
 (0)