You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd recommend trying a KDE method that actually supports circular data and plotting the results. The geom_density() layer wraps stats::density(), which doesn't support circular data. I have no experience with it, but you could try out circular::density.circular() for your data.
I don't know of any extensions implementing circular density, so unless you're interested in implenting such extension yourself, my advice is to just precalculate the density yourself and plot the results with ggplot2. If you need any help, I'd recommend trying the posit community or stack overflow. Implementing circular densities in ggplot2 itself is out of scope, per the same reasoning given in #5733.
Hello,
In my dataset,
I have a observed bird and their direction, ranging from 0 to 360, which correspond to birds heading towards North.
To represent this, I want to make a circular density plot like so :
ggplot(echo %>% filter(!is.na(direction)), aes(x = direction)) +
geom_density(fill = "grey", adjust=0.5) +
coord_polar(theta = "x", start = 2*pi) + # Polar coordinates for circular plotting
labs(x = "", y = "Density", title = "Bird Direction") +
scale_x_continuous(
limits = c(0, 360), # Ensure the x-axis spans 0 to 360 degrees
breaks = c(0, 90, 180, 270), # Set the x-axis breaks at N, E, S, W
labels = c("N", "E", "S", "W") # Label breaks as compass directions
) +
theme(
axis.text.y = element_blank(), # Remove y-axis numbers
axis.ticks.y = element_blank() # Remove y-axis ticks
)
The issue here is that their is a pick to 0 that does not represent the actual data.
Could someone help me out ?
Best regards
The text was updated successfully, but these errors were encountered: