Skip to content

Commit 7ed8930

Browse files
authored
Minor fixes to keep compatibility with ggtern (#2913)
* fixes to keep compatibility with ggtern * allow CRAN ggtern to work with geom_sf()
1 parent e9f7ded commit 7ed8930

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

R/ggplot-global.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,22 @@ ggplot_global$theme_current <- list()
1313
ggplot_global$element_tree <- list()
1414

1515
# List of all aesthetics known to ggplot
16-
ggplot_global$all_aesthetics <- c(
16+
# (In the future, .all_aesthetics should be removed in favor
17+
# of direct assignment to ggplot_global$all_aesthetics, see below.)
18+
.all_aesthetics <- c(
1719
"adj", "alpha", "angle", "bg", "cex", "col", "color",
1820
"colour", "fg", "fill", "group", "hjust", "label", "linetype", "lower",
1921
"lty", "lwd", "max", "middle", "min", "pch", "radius", "sample", "shape",
2022
"size", "srt", "upper", "vjust", "weight", "width", "x", "xend", "xmax",
2123
"xmin", "xintercept", "y", "yend", "ymax", "ymin", "yintercept", "z"
2224
)
2325

26+
ggplot_global$all_aesthetics <- .all_aesthetics
27+
2428
# Aesthetic aliases
25-
ggplot_global$base_to_ggplot <- c(
29+
# (In the future, .base_to_ggplot should be removed in favor
30+
# of direct assignment to ggplot_global$base_to_ggplot, see below.)
31+
.base_to_ggplot <- c(
2632
"col" = "colour",
2733
"color" = "colour",
2834
"pch" = "shape",
@@ -36,3 +42,5 @@ ggplot_global$base_to_ggplot <- c(
3642
"min" = "ymin",
3743
"max" = "ymax"
3844
)
45+
46+
ggplot_global$base_to_ggplot <- .base_to_ggplot

R/sf.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ default_aesthetics <- function(type) {
199199
}
200200
}
201201

202-
sf_grob <- function(row, lineend, linejoin, linemitre) {
202+
sf_grob <- function(row, lineend = "butt", linejoin = "round", linemitre = 10) {
203203
# Need to extract geometry out of corresponding list column
204204
geometry <- row$geometry[[1]]
205205

R/theme-elements.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,9 @@ el_def <- function(class = NULL, inherit = NULL, description = NULL) {
256256

257257

258258
# This data structure represents the theme elements and the inheritance
259-
# among them.
260-
ggplot_global$element_tree <- list(
259+
# among them. (In the future, .element_tree should be removed in favor
260+
# of direct assignment to ggplot_global$element_tree, see below.)
261+
.element_tree <- list(
261262
line = el_def("element_line"),
262263
rect = el_def("element_rect"),
263264
text = el_def("element_text"),
@@ -352,6 +353,7 @@ ggplot_global$element_tree <- list(
352353
aspect.ratio = el_def("character")
353354
)
354355

356+
ggplot_global$element_tree <- .element_tree
355357

356358
# Check that an element object has the proper class
357359
#

0 commit comments

Comments
 (0)