I have to create circular plot like image
My data is like that
i have to create circular plot in R that looks like the attached image?
You have only provided a small number of data points (and in fact only a picture of a small number of data points). Making these reproducible in R, we have:
df <- data.frame(col1 = c(2, 26, 26, 27, 27, 28, 28, 28),
col2 = c(94, 146, 175, 213, 213, 55, 247, 263))
And we can plot the result (which is just a circular graph) like this:
library(tidygraph)
library(ggraph)
df %>%
bind_rows(data.frame(col1 = 1:360, col2 = 1:360)) %>%
arrange(col1) %>%
as_tbl_graph() %>%
activate(edges) %>%
mutate(diff = as.character(abs(from - to))) %>%
ggraph(layout = "linear", circular = TRUE) +
geom_edge_arc(aes(colour = diff), lwd = 1) +
ggforce::geom_circle(aes(x0 = 0, y0 = 0, r = 1.024), size = 15,
color = '#fff450') +
geom_node_text(aes(label = ifelse(as.numeric(name) %% 10 == 0, name, ""),
angle = -as.numeric(name) + 90)) +
coord_equal() +
theme_graph() +
theme(plot.background = element_rect(fill = 'black'),
legend.position = 'none')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.