Experimenting with ggplot2 I noticed a difference in the graphical output between geom_bar/geom_col and geom_linerange. As soon as I use these functions in combination with coord_polar (to create pie or donut charts) the first two outputs are pixellated whereas geom_linerange produces smooth lines.
I am fine with that. Still I wonder why and where in the process of creating the output this difference occures?
d <- dplyr::tibble(GRP=c("A","B","C"),
VAL=c(20,30,50))
p1 <- d %>%
ggplot2::ggplot(ggplot2::aes(x=2,y=VAL,fill=GRP)) +
ggplot2::geom_bar(width=1.5,stat="identity") +
ggplot2::coord_polar(theta="y") +
ggplot2::ggtitle("geom_bar") +
ggplot2::xlim(c(0,4)) +
ggplot2::theme_void()
p2 <- d %>%
ggplot2::ggplot(ggplot2::aes(x=2,y=VAL,fill=GRP)) +
ggplot2::geom_col(width=1.5) +
ggplot2::coord_polar(theta="y") +
ggplot2::ggtitle("geom_col") +
ggplot2::xlim(c(0,4)) +
ggplot2::theme_void()
p3 <- d %>%
dplyr::mutate(YMAX=cumsum(VAL),
YMIN=dplyr::lag(YMAX,1,default=0)) %>%
ggplot2::ggplot(ggplot2::aes(x=0,ymin=YMIN,ymax=YMAX,color=GRP)) +
ggplot2::geom_linerange(size=7) +
ggplot2::coord_polar(theta="y") +
ggplot2::ggtitle("geom_Linerange") +
ggplot2::theme_void()
gridExtra::grid.arrange(p1,p2,p3)

