Error in `geom_jitter()`: ! both `position` and `width`/`height` are supplied ℹ Only use one approach to alter the position Run `rlang::last_trace()` to see where the error occurred.
时间: 2023-07-24 20:04:51 浏览: 57
I apologize for the confusion. To fix the error in the `geom_jitter()` function, you need to remove either the `position` or the `width`/`height` argument since both cannot be used together.
If you want to modify the position of the jittered points, you can remove the `width` argument and use the `position` argument to adjust the position. Here's an example of how you can modify the code:
```R
ggplot(df_long_st, aes(x = site, y = st, fill = site)) +
geom_half_violin(side = "r", scale = "width", position = position_nudge(x = 0.1)) +
geom_boxplot(width = 0.15, fill = "white", position = position_nudge(x = -0.1)) +
geom_jitter(aes(color = site), position = position_nudge(x = -0.1))
```
In this modified code, I removed the `width` argument from the `geom_jitter()` function and kept the `position` argument as `position = position_nudge(x = -0.1)`. This will shift the position of the jittered points collectively to the left by 0.1 units.
Please give it a try and let me know if you encounter any further issues.