gene_x 0 like s 279 view s
Tags: plot, R
a dashed vertical line dividing two sets of rectangular bars.
library(ggplot2)
# Install and load the ggplot2 package
install.packages("ggplot2")
library(ggplot2)
# Create a mock dataset for the left visualization
left_data <- data.frame(
group = c(rep("A", 5), rep("B", 3)),
value = c(1, 2, 3, 4, 5, 6, 7, 8)
)
left_plot <- ggplot(left_data, aes(x=group, y=value)) +
geom_col(position="dodge") +
geom_vline(xintercept=1.5, linetype="dashed") +
theme_minimal()
# Create a mock dataset for the right visualization
right_data <- data.frame(
x = 1:20,
y = rnorm(20, 10, 5),
group = sample(c("red", "blue"), 20, replace=TRUE)
)
right_plot <- ggplot(right_data, aes(x=x, y=y)) +
geom_col(aes(fill="blue"), width=0.5) +
geom_point(aes(color=group), size=4, position=position_jitter(width=0.3, height=0)) +
scale_color_manual(values=c("red"="red", "blue"="blue")) +
theme_minimal()
# Combine and display the plots
library(gridExtra)
png("plot1.png", width=800, height=800)
grid.arrange(left_plot, right_plot, ncol=2)
dev.off()
a bar plot with overlaid scatter points in two colors.
点赞本文的读者
还没有人对此文章表态
没有评论
MicrobiotaProcess Group2 vs Group6 (v1)
Bubble plot for 1457∆atlE vs 1457-M10 vs 1457 vs mock
© 2023 XGenes.com Impressum