Help with Circular Histogram

I need help with making a circular histogram out of a set of directional measurements in degrees (°).
I took the code from another histogram, but I need the x axis—plotted on the circle— to be in degrees and not hours like it was before.

Polar1 <- c(256, 235, 216,276,219,168, 290)

< library(ggplot,tiddyverse)

< Polar1 %>%
gather(variable, value) %>%
ggplot(mapping = aes(x = vlaue)) + coord_polar(theta = "x", start = 0, direction = 1, clip = "on")
geom_bar(stat = "identity", fill = "black", width = .9) geom_hline(yintercept = seq(0, 24, by = 2), color = "grey80", size = 0.3) +
scale_x_continuous(breaks = 0:24, expand = c(.002,0)) +
labs(x = "Degrees", title = "Tree Lean") +

What do I need to do to fix this.


First, you need to check your code for obvious syntax errors and typos e.g.

You can't call several libraries within a single library() call and the correct package names are ggplot2 and tidyverse.

Also, dplyr and ggplot2 work with data frames not with vectors like the one you have provided as sample data, please check again and try to provide a proper REPRoducible EXample (reprex)

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.