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
Hello! I believe there is a bug happening when using position_dodge2. When I create the plot with position_dodge, the error bars are properly centered in the bars. But I need to reverse the bars and error bars. So I need to use position_dodge2 (reverse = TRUE). But when I do that, the error bars are not properly centered. I have tried a lot of solutions, but nothing is working. Here follows the code:
Could I ask you to convert your example code to a self-contained, minimal, reproducible example? If you've never heard of a reprex, please read "Make a reprex". Currently, it is hard to see how the code you have provided interacts with data you have not provided and the code is intertwined with code that is probably unrelated to the problem (e.g. theme settings).
Hello! I believe there is a bug happening when using position_dodge2. When I create the plot with position_dodge, the error bars are properly centered in the bars. But I need to reverse the bars and error bars. So I need to use position_dodge2 (reverse = TRUE). But when I do that, the error bars are not properly centered. I have tried a lot of solutions, but nothing is working. Here follows the code:
bar_errorbar <- ggplot2::ggplot(error_bar_pivot_longer_tibble_summarised_ordered, # nolint: object_usage_linter.
ggplot2::aes(mean, name, fill = group)) + # nolint
ggplot2::geom_errorbar(
ggplot2::aes(xmax = mean + sd, xmin = 0),
position = ggplot2::position_dodge2(width = 0.8, reverse = TRUE),
width = 0.5,
size = 0.5,
color = "black"
) +
ggplot2::geom_bar(stat = "identity", position = ggplot2::position_dodge2(width = 0.8, reverse = TRUE),
width = 0.8) +
GGally::geom_stripped_cols(width = 10) +
ggplot2::scale_fill_manual(values = colors) +
ggplot2::scale_color_manual(values = colors) +
ggprism::theme_prism() +
ggplot2::scale_x_continuous(expand = c(0, 0),
guide = "prism_offset_minor",) +
ggplot2::scale_y_discrete(labels = rev(daa_results_filtered_sub_df[, x_lab])) +
ggplot2::labs(x = "Relative Abundance", y = NULL) +
ggplot2::theme(
axis.ticks.y = ggplot2::element_blank(),
axis.line.y = ggplot2::element_blank(),
axis.line.x = ggplot2::element_line(size = 0.5),
axis.ticks.x = ggplot2::element_line(size = 0.5),
panel.grid.major.y = ggplot2::element_blank(),
panel.grid.major.x = ggplot2::element_blank(),
axis.text = ggplot2::element_text(size = 10, color = "black"), # nolint
axis.text.x = ggplot2::element_text(margin = ggplot2::margin(r = 0)), # nolint
axis.text.y = ggplot2::element_text(
size = 10,
color = "black",
margin = ggplot2::margin(b = 6)
),
axis.title.x = ggplot2::element_text(
size = 10,
color = "black",
hjust = 0.5
),
legend.position = "right",
legend.key.size = ggplot2::unit(0.1, "cm"),
legend.direction = "vertical",
legend.justification = "left",
legend.text = ggplot2::element_text(size = 8, face = "bold"),
legend.box.just = "right",
plot.margin = ggplot2::margin(0, 0.5, 0.5, 0, unit = "cm")
) + ggplot2::coord_cartesian(clip = "off")
Maybe I am missing something, but, since I tried a lot to solve this issue without success, I believe there is a bug going on here.
Thanks so much for the attention.
The text was updated successfully, but these errors were encountered: