我正在使用 gghistogram 绘制玫瑰图。这是我到目前为止所拥有的:
数据:
structure(list(Dataset = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L),.Label = "Outcrop 9", class = "factor"), Orientation = c(205L, 124L, 312L, 212L,196L, 203L, 212L, 155L, 193L, 160L)), class = "data.frame", row.names = c(NA, -10L))
我正在寻找转动图表,因此 0/360 位于顶部(北)。此外,有没有办法将“0/360”重新标记为“0”?
当前代码:
library(ggplot2)
library(scales)
colours<-c("#D52B1E","pink","black")
plot<-ggplot() +
geom_line(aes(x = c(0, 360), y = c(4, 4)), colour = "gray75") +
geom_line(aes(x = c(0, 360), y = c(8, 8)), colour = "gray75") +
geom_line(aes(x = c(0, 360), y = c(12, 12)), colour = "gray75") +
geom_line(aes(x = c(0, 360), y = c(16, 16)), colour = "gray75") +
geom_line(aes(x = c(0, 360), y = c(20, 20)), colour = "gray75") +
geom_vline(aes(xintercept = 0:12 * 30), colour = "gray75") +
geom_histogram(data = df, aes(x=Orientation, fill=factor(Dataset)),
position = "stack", colour = "black", binwidth = 20,
boundary = 0) +theme_bw() + scale_fill_manual(values=colours)+
coord_polar(start = 3 * pi / 2) +
scale_x_continuous(limits = c(0, 360), breaks = 0:12 * 30) +
scale_y_continuous(limits = c(0, 4)) + theme(panel.border=element_blank(), axis.title.y = element_blank(), axis.title.x = element_blank(),legend.position="none")```
(Please ignore the fact that I have added extra colours, I will be adding in two more datasets later)