Skip to content

Circular density plot pick to 0 #6204

Closed as not planned
Closed as not planned
@victorcat4

Description

@victorcat4

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
)

Image

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions