1

Why are my point ranges not lining up with my jitter points? When I run the data in the jitter itself it runs fine, I tried to play around with the position in the pointrange, but nothing has helped so far. Any ideas?

    monoculture_density_plot_C <- ggplot() +
    geom_jitter(data = long_monoculture_df_2C, 
              aes(x = Dominant_Species, 
                  y = Density_2), 
              position = position_jitter(0.5), 
              color = "#A85FD5",
              fill =  "#A85FD5",
              size = 2,
              alpha = 0.5,
              shape = 21) +
    geom_pointrange(data = long_monoculture_summaryC,
                      aes(x = Dominant_Species,
                      y = Mean_2,
                      ymin = Mean_2 - SE_2, 
                      ymax = Mean_2 + SE_2)) +
    labs(title = "Monoculture density - Control",
       subtitle = "Year 2") + 
       xlab("Species") +
    ylab(expression(paste("Individuals / ", m^2))) +
    theme(text = element_text(size = 14)) +
    theme(plot.title = element_text(hjust = 0.5)) +
    theme(panel.background = element_rect(fill = "white")) +
    theme(axis.line = element_line(colour = 'black', size = 0.5, linetype = 'solid')) +
    scale_y_log10(limits = c(1, 1e4), expand = c(0, 0))

    print(monoculture_density_plot_C)

enter image description here

eglease
  • 2,445
  • 11
  • 18
  • 28
  • 1
    Welcome to SO! As we don't have your data we can only guess what's the reason for this issue. My guess is that your `Dominant_Species` column in your `long_monoculture_summaryC` is a numeric. For more help please provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) including a snippet of both datasets via `dput()`. – stefan Jun 01 '23 at 09:28
  • Per default, `position_jitter(0.5)` spreads in horizontal *and* vertical direction. In addition to stefans advice for horizontal alignment, you can try `position_jitter(height = 0, width = 0.5)` to avoid vertical jitter and maintain alignment with the vertical point range. – I_O Jun 01 '23 at 09:38

0 Answers0