Reputation: 29
I have plotted a circular dot plot in R using the circular package, and I am trying to figure out how to stack the dots inside the circle (instead of outside as shown).
library("circular")
control.circ <- circular(ACT34_radarplot_input, units = "hours", template = "clock24")
# Plot circular dot plot w/ stacked dots
plot.circular(control.circ, stack = TRUE, pch = 20, sep = 0.05, shrink = 1.0, col = "red", main = "Act 34 Significant Genes Phases")
Upvotes: 1
Views: 580
Reputation: 173928
I'm not sure this is possible with circular
, but it can be done in ggplot
with a bit of data manipulation. Although you did not include it in your question, I assume ACT34_radarplot_input
is just a vector of numbers between 0 and 24, so we can replicate it like this:
set.seed(1)
ACT34_radarplot_input <- runif(300, 0, 24)
You can reshape and plot this in gpplot as follows:
library(tidyverse)
ACT34_radarplot_input %>%
hist(breaks = seq(0, 24, 0.2), plot = FALSE) %>%
`[`(c(2, 4)) %>%
as_tibble() %>%
group_by(mids) %>%
summarize(y = -seq(counts), .groups = "drop") %>%
filter(y < 0) %>%
ggplot(aes(mids, y)) +
geom_point(col = "red2", size = 3) +
geom_hline(yintercept = 0) +
scale_x_continuous(breaks = c(0:24), limits = c(0, 24)) +
ylim(c(-20, 0)) +
coord_polar() +
ggtitle("Act 34 Significant Genes Phases") +
theme_void() +
theme(axis.text.x = element_text(size = 16),
plot.title = element_text(size = 20, hjust = 0.5))
Upvotes: 1