1

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")

Example of what I have so far

1
  • 1
    There are ways to do this, but it is dependent on your data structure. Can you edit your question to include the output of dput(ACT34_radarplot_input)? Commented Aug 31, 2022 at 17:11

1 Answer 1

1

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))

enter image description here

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

2 Comments

Is there an easy way to have less space between the dots?
Change the size of the points geom_point(col = "red2", size = 2) +

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.