I am using ggforce package, an extension of ggplot2 to label a plot.
library(tidyverse)
library(ggforce)
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_circle(aes(color = Species,
label = Species),
label.fill = NA,
# 背景颜色变成透明
# The fill colour for the annotation box
label.fontface = 'plain',
# 避免加粗
expand = unit(0.2, "mm")
) +
geom_point() +
theme(
legend.position = 'none'
) +
theme_minimal()
I want to make the circle smaller. I read the help document and try several values on the argument expand
but it does works.
Does anyone know it?
mara
April 1, 2019, 9:19am
2
Since you're using geom_mark_circle()
(as opposed to ellipse, or another shape), you're getting the smallest possible circle that can encompass all points for a specified group.
1 Like
HI @mara , I get your point.
ggplot(iris, aes(Petal.Length, Petal.Width)) +
geom_mark_circle(data = iris %>% head(6),
aes(color = Species,
label = Species),
label.fill = NA,
# 背景颜色变成透明
# The fill colour for the annotation box
label.fontface = 'plain',
# 避免加粗
expand = unit(0.2, "mm")
) +
geom_point() +
theme(
legend.position = 'none'
) +
theme_minimal()
When I change the size of the group I choose compared to the whole sample, the circle becomes automatically smaller.
1 Like
system
Closed
April 8, 2019, 11:57am
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.