diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION
new file mode 100644
index 0000000..5e17e7b
--- /dev/null
+++ b/CRAN-SUBMISSION
@@ -0,0 +1,3 @@
+Version: 1.1.0
+Date: 2025-09-17 11:38:56 UTC
+SHA: 54fed5bb7c0f4c027fbdab0a6f5a9acaed75e7f5
diff --git a/DESCRIPTION b/DESCRIPTION
index 13995ae..748a72b 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,6 +1,6 @@
Package: ggpath
Title: Robust Image Rendering Support for 'ggplot2'
-Version: 1.0.2.9002
+Version: 1.1.0
Authors@R:
person("Sebastian", "Carl", , "mrcaseb@gmail.com", role = c("aut", "cre", "cph"))
Description: A 'ggplot2' extension that enables robust image grobs in
@@ -14,7 +14,7 @@ Depends:
Imports:
cachem (>= 1.0.0),
cli (>= 3.0.0),
- ggplot2 (>= 3.5.2.9002),
+ ggplot2 (>= 4.0.0),
grid,
magick (>= 2.7.3),
memoise (>= 2.0.0),
@@ -26,9 +26,6 @@ Suggests:
testthat (>= 3.0.0),
vdiffr (>= 1.0.2)
Config/testthat/edition: 3
-Config/Needs/check: tidyverse/ggplot2
-Config/Needs/website: tidyverse/ggplot2
-Remotes: tidyverse/ggplot2
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.3.2
+RoxygenNote: 7.3.3
diff --git a/NEWS.md b/NEWS.md
index dd83203..03f76dc 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,4 +1,4 @@
-# ggpath (development version)
+# ggpath 1.1.0
ggpath now requires ggplot2 v4! This package is intended to be a ggplot2 extension
and if ggplot2 version jumps make breaking changes, then it's best for the extension
diff --git a/R/build_grobs.R b/R/build_grobs.R
index 4f5162f..dad33ff 100644
--- a/R/build_grobs.R
+++ b/R/build_grobs.R
@@ -62,8 +62,8 @@ build_grobs <- function(i, alpha, colour, path, data,
vp = grid::viewport(
x = grid::unit(data$x[i], "npc"),
y = grid::unit(data$y[i], "npc"),
- width = grid::unit(data$width[i], "npc"),
- height = grid::unit(data$height[i], "npc"),
+ width = data$width[i],
+ height = data$height[i],
angle = data$angle[i]
),
just = c(data$hjust[i], data$vjust[i]),
diff --git a/R/theme_element.R b/R/theme_element.R
index ab05122..ff31570 100644
--- a/R/theme_element.R
+++ b/R/theme_element.R
@@ -219,8 +219,8 @@ S7::method(element_grob, element_path) <- function(
y = as.numeric(y),
hjust = rep(hj, n),
vjust = rep(vj, n),
- width = rep(1, n),
- height = rep(1, n),
+ width = rep(size, n),
+ height = rep(size, n),
angle = rep(angle, n)
),
is_theme_element = TRUE
diff --git a/README.Rmd b/README.Rmd
index 6d85845..c008981 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -48,7 +48,7 @@ The two main features to provide images in a ggplot are a geom (`geom_from_path(
The below examples use local image files that are shipped with the package. Let's locate the images first.
```{r}
-local_r_logo <- system.file("r_logo.png", package = "ggpath")
+r_logo <- "https://cran.r-project.org/Rlogo.svg"
local_background_image <- system.file("example_bg.jpg", package = "ggpath")
```
@@ -59,7 +59,7 @@ Now, we can make a simple plot, where we use the logo image like a point by repl
```{r dpi=300}
library(ggplot2)
library(ggpath)
-plot_data <- data.frame(x = c(-1, 1), y = 1, path = local_r_logo)
+plot_data <- data.frame(x = c(-1, 1), y = 1, path = r_logo)
ggplot(plot_data, aes(x = x, y = y)) +
geom_from_path(aes(path = path), width = 0.2) +
coord_cartesian(xlim = c(-2, 2)) +
@@ -71,16 +71,16 @@ ggplot(plot_data, aes(x = x, y = y)) +
We can build on top of that by adding new axis labels, axis titles, plot title and subtitle, or a caption and using a ggpath theme element. Note the usage of transparency with the `alpha` argument, the justification with the `hjust`/`vjust` arguments, or the rotation with the `angle` argument.
```{r dpi=300}
-ggplot(plot_data, aes(x = x, y = local_r_logo)) +
+ggplot(plot_data, aes(x = x, y = r_logo)) +
geom_from_path(aes(path = path), width = 0.2, alpha = 0.2) +
coord_cartesian(xlim = c(-2, 2)) +
theme_minimal() +
labs(
- title = local_r_logo,
- subtitle = local_r_logo,
- x = local_r_logo,
- y = local_r_logo,
- caption = local_r_logo
+ title = r_logo,
+ subtitle = r_logo,
+ x = r_logo,
+ y = r_logo,
+ caption = r_logo
) +
theme(
plot.caption = element_path(hjust = 1, size = grid::unit(4, "lines")),
@@ -105,7 +105,7 @@ ggplot(plot_data, aes(x = x, y = 1)) +
x = "x axis label",
y = "y axis label",
caption = "useful caption",
- tag = local_r_logo
+ tag = r_logo
) +
theme(
plot.tag = element_path(size = 2, vjust = 1, alpha = 0.7),
@@ -117,7 +117,7 @@ Please note how to place the image in the whole plot area via `plot.tag.position
### Images in Theme Elements (element_raster)
-The second theme element, `element_raster()`, allows rendering of images in the plot background. It is a replacement for `ggplot2::element_rect()`. In the following example, we plot the two logos again and now set a sample background. The sample background is a photo by [Dan Cristian Pădureț](https://unsplash.com/@dancristianpaduret?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash) on [Unsplash](https://unsplash.com/photos/white-printer-paper-on-brown-textile-izq7BRX6xfw?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash).
+The second theme element, `element_raster()`, allows rendering of images in the plot background. It is a replacement for `ggplot2::element_rect()`. In the following example, we plot the two logos again and now set a sample background. The sample background is a photo by Dan Cristian Pădureț on Unsplash.
```{r dpi=300}
ggplot(plot_data, aes(x = x, y = y)) +
@@ -171,8 +171,3 @@ There are some downsides compared to the above mentioned packages, e.g.
- cannot combine images and text to a grob as ggtext can with [`element_markdown`](https://wilkelab.org/ggtext/reference/element_markdown.html),
- cannot modify css parts of svgs as [ggsvg can](https://github.com/coolbutuseless/ggsvg#styling-svg-with-css-aesthetics-example-1).
-
-
-
-
-
diff --git a/README.md b/README.md
index a8a9aa5..fc9bcd7 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ The below examples use local image files that are shipped with the
package. Let’s locate the images first.
``` r
-local_r_logo <- system.file("r_logo.png", package = "ggpath")
+r_logo <- "https://cran.r-project.org/Rlogo.svg"
local_background_image <- system.file("example_bg.jpg", package = "ggpath")
```
@@ -65,7 +65,7 @@ by replacing the local path with the actual image.
``` r
library(ggplot2)
library(ggpath)
-plot_data <- data.frame(x = c(-1, 1), y = 1, path = local_r_logo)
+plot_data <- data.frame(x = c(-1, 1), y = 1, path = r_logo)
ggplot(plot_data, aes(x = x, y = y)) +
geom_from_path(aes(path = path), width = 0.2) +
coord_cartesian(xlim = c(-2, 2)) +
@@ -83,16 +83,16 @@ with the `hjust`/`vjust` arguments, or the rotation with the `angle`
argument.
``` r
-ggplot(plot_data, aes(x = x, y = local_r_logo)) +
+ggplot(plot_data, aes(x = x, y = r_logo)) +
geom_from_path(aes(path = path), width = 0.2, alpha = 0.2) +
coord_cartesian(xlim = c(-2, 2)) +
theme_minimal() +
labs(
- title = local_r_logo,
- subtitle = local_r_logo,
- x = local_r_logo,
- y = local_r_logo,
- caption = local_r_logo
+ title = r_logo,
+ subtitle = r_logo,
+ x = r_logo,
+ y = r_logo,
+ caption = r_logo
) +
theme(
plot.caption = element_path(hjust = 1, size = grid::unit(4, "lines")),
@@ -123,7 +123,7 @@ ggplot(plot_data, aes(x = x, y = 1)) +
x = "x axis label",
y = "y axis label",
caption = "useful caption",
- tag = local_r_logo
+ tag = r_logo
) +
theme(
plot.tag = element_path(size = 2, vjust = 1, alpha = 0.7),
@@ -143,10 +143,7 @@ The second theme element, `element_raster()`, allows rendering of images
in the plot background. It is a replacement for
`ggplot2::element_rect()`. In the following example, we plot the two
logos again and now set a sample background. The sample background is a
-photo by [Dan Cristian
-Pădureț](https://unsplash.com/@dancristianpaduret?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash)
-on
-[Unsplash](https://unsplash.com/photos/white-printer-paper-on-brown-textile-izq7BRX6xfw?utm_content=creditCopyText&utm_medium=referral&utm_source=unsplash).
+photo by Dan Cristian Pădureț on Unsplash.
``` r
ggplot(plot_data, aes(x = x, y = y)) +
diff --git a/cran-comments.md b/cran-comments.md
index 69a8e23..c6229fd 100644
--- a/cran-comments.md
+++ b/cran-comments.md
@@ -1,6 +1,6 @@
## Submission
-This is a patch release that fixes check NOTEs
+This is a patch release that fixes failing tests due to ggplot2 v4 release.
## R CMD check results
diff --git a/man/figures/README-unnamed-chunk-4-1.png b/man/figures/README-unnamed-chunk-4-1.png
index 325f581..9b58446 100644
Binary files a/man/figures/README-unnamed-chunk-4-1.png and b/man/figures/README-unnamed-chunk-4-1.png differ
diff --git a/man/figures/README-unnamed-chunk-5-1.png b/man/figures/README-unnamed-chunk-5-1.png
index 9904b03..faa24b1 100644
Binary files a/man/figures/README-unnamed-chunk-5-1.png and b/man/figures/README-unnamed-chunk-5-1.png differ
diff --git a/man/figures/README-unnamed-chunk-6-1.png b/man/figures/README-unnamed-chunk-6-1.png
index 270c6d0..e38dfa2 100644
Binary files a/man/figures/README-unnamed-chunk-6-1.png and b/man/figures/README-unnamed-chunk-6-1.png differ
diff --git a/man/figures/README-unnamed-chunk-7-1.png b/man/figures/README-unnamed-chunk-7-1.png
index d28f913..29fb619 100644
Binary files a/man/figures/README-unnamed-chunk-7-1.png and b/man/figures/README-unnamed-chunk-7-1.png differ
diff --git a/tests/testthat/_snaps/theme-elements/p1.svg b/tests/testthat/_snaps/theme-elements/p1.svg
index 1935c95..2e4b438 100644
--- a/tests/testthat/_snaps/theme-elements/p1.svg
+++ b/tests/testthat/_snaps/theme-elements/p1.svg
@@ -44,9 +44,9 @@
0.0
0.5
1.0
-
+
-
-
+
+
diff --git a/tests/testthat/_snaps/theme-elements/p2.svg b/tests/testthat/_snaps/theme-elements/p2.svg
index 0fb87d4..a9b941b 100644
--- a/tests/testthat/_snaps/theme-elements/p2.svg
+++ b/tests/testthat/_snaps/theme-elements/p2.svg
@@ -38,15 +38,15 @@
-
+
-1.0
-0.5
0.0
0.5
1.0
-
-
-
-
+
+
+
+