Skip to content

Commit

Permalink
Allow partial labelling of marks
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasp85 committed Jan 18, 2024
1 parent 6f1f8d8 commit 4d24824
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Fixed a bug that would cause reordering of data in some geoms (#314)
* The concaveman package is no longer a dependency for `geom_mark_hull()` (#308)
* Setting both label and description to `NA` will now turn off label drawing for
that mark completely while still drawing the mark

# ggforce 0.4.1

Expand Down
1 change: 1 addition & 0 deletions R/mark_circle.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ circEncGrob <- function(x = c(0, 0.5, 1, 0.5), y = c(0.5, 1, 0.5, 0), id = NULL,
)
if (!is.null(label)) {
label <- lapply(seq_len(nrow(label)), function(i) {
if (is.na(label$label[i] %||% NA) && is.na(label$description[i] %||% NA)) return(zeroGrob())
grob <- labelboxGrob(label$label[i], 0, 0, label$description[i],
gp = label.gp, pad = label.margin, width = label.width,
min.width = label.minwidth, hjust = label.hjust
Expand Down
1 change: 1 addition & 0 deletions R/mark_ellipse.R
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ ellipEncGrob <- function(x = c(0, 0.5, 1, 0.5), y = c(0.5, 1, 0.5, 0), id = NULL
)
if (!is.null(label)) {
label <- lapply(seq_len(nrow(label)), function(i) {
if (is.na(label$label[i] %||% NA) && is.na(label$description[i] %||% NA)) return(zeroGrob())
grob <- labelboxGrob(label$label[i], 0, 0, label$description[i],
gp = label.gp, pad = label.margin, width = label.width,
min.width = label.minwidth, hjust = label.hjust
Expand Down
1 change: 1 addition & 0 deletions R/mark_hull.R
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ hullEncGrob <- function(x = c(0, 0.5, 1, 0.5), y = c(0.5, 1, 0.5, 0), id = NULL,
)
if (!is.null(label)) {
label <- lapply(seq_len(nrow(label)), function(i) {
if (is.na(label$label[i] %||% NA) && is.na(label$description[i] %||% NA)) return(zeroGrob())
grob <- labelboxGrob(label$label[i], 0, 0, label$description[i],
gp = label.gp, pad = label.margin, width = label.width,
min.width = label.minwidth, hjust = label.hjust
Expand Down
1 change: 1 addition & 0 deletions R/mark_rect.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ rectEncGrob <- function(x = c(0, 0.5, 1, 0.5), y = c(0.5, 1, 0.5, 0), id = NULL,
)
if (!is.null(label)) {
label <- lapply(seq_len(nrow(label)), function(i) {
if (is.na(label$label[i] %||% NA) && is.na(label$description[i] %||% NA)) return(zeroGrob())
grob <- labelboxGrob(label$label[i], 0, 0, label$description[i],
gp = label.gp, pad = label.margin, width = label.width,
min.width = label.minwidth, hjust = label.hjust
Expand Down

0 comments on commit 4d24824

Please sign in to comment.