79559405

Date: 2025-04-07 08:35:55
Score: 0.5
Natty:
Report link

You can try as below:

# Flip ID order to mirror horizontally
df_long$ID <- factor(df_long$ID, levels = rev(unique(df_long$ID)))

# Create mirrored plot
ggplot(df_long, aes(x = Variable, y = ID, color = Z_score, size = abs(Z_score))) +
geom_point() +
facet_grid(rows = vars(Group), scales = "free_y", space = "free_y", switch = "y") + 
scale_color_gradient2(low = "blue", mid = "white", high = "red", midpoint = 0) +
scale_y_discrete(position = "right") + theme_minimal() + theme(axis.text.x = element_text(angle = 45, hjust = 1),strip.placement = "outside", strip.text.y.right = element_text(angle = 0), strip.text.y.left = element_blank(), strip.background = element_blank() ) + labs(x = "Variables", y = "Cell Line", color = "Z-Score", size = "Magnitude")

enter image description here

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: jynxmaze