0

I'm trying to get a hollow point to have the same line type as an associated line range. For instance

library(tidyverse)

data.frame(
    x = letters[1:2] %>% 
      factor,
    ymin = 4:5,
    y = 5:6,
    ymax = 6:7
  ) %>% 
  ggplot() +
  geom_linerange(
    aes(x, ymin = ymin, ymax = ymax),
    linetype = "dashed"
  ) +
  geom_point(
    aes(x = x, y = y),
    shape = 21,
    size = 10,
    fill = "grey95",
    linetype = "dashed"
    ) +
  theme_void()

returns this

pointrange

How so I get the points' borders to also be dashed?

7
  • 1
    I believe shapes of central pieces in geom_linerange is limited to these shapes: github.com/tidyverse/ggplot2/blob/master/R/geom-point.r#L140 Commented Oct 22, 2018 at 19:35
  • I'm using geom_point() for the middle part Commented Oct 22, 2018 at 19:44
  • The function I link to is used by geom_point as well. You may have to implement some sort of graphics to achieve a dashed circle. Something along the lines of stackoverflow.com/questions/27637455/… Commented Oct 22, 2018 at 19:48
  • 1
    Maybe use 'dotted circle' unicode symbol ("\u25CC") as shape, or draw circles with desired linetype Commented Oct 22, 2018 at 19:52
  • 1
    @tomw Feel free to provide a self-answer! Cheers Commented Oct 22, 2018 at 20:03

1 Answer 1

1

with thanks to @Henrik, ggforce::geom_circle() has the necessary functionality

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.