p+labs(x = "", y = "") + #scale_x_continuous(breaks = seq(min(data$ID), max(data$ID), by = 1)) + # Add this line #scale_y_continuous(expand = c(0,0),limits = c(0,100),breaks = seq(0, 100, by = 20)) + theme_classic() + theme( panel.background = element_rect(fill="white", colour="white", size=0.25), axis.line = element_line(colour="black", size=0.5), axis.title = element_text(size=13, color="black"), axis.text = element_text(size=12, color="black"), legend.position = c(0.9, 0.9), #修改图例位置 legend.text = element_text(size =10), aspect.ratio = 1, # set figure size to 8x6 inches plot.title = element_text(size = 10), # optional, add a title axis.text.x = element_text(angle = 45, hjust = 1), # Rotate x-axis labels by 45 degrees legend.box.spacing = unit(0.1, "cm"), # 设置图例中每个元素的间距 #legend.key.width = 0.5, # 缩小图例颜色方块的宽度 legend.background = element_blank() # 设置图例背景为透明 ) + guides(fill = guide_legend(reverse = TRUE)) 修改脚本,将X轴设置在0位置处,并且将图例用一列显示
时间: 2024-04-29 20:20:22 浏览: 70
SI472X.rar_Si472X_si472x datasheet
p+labs(x = "", y = "") +
scale_x_continuous(expand = c(0,0),limits = c(0,max(data$ID)),breaks = seq(0, max(data$ID), by = 1)) + #修改X轴,设置在0位置处
scale_y_continuous(expand = c(0,0),limits = c(0,100),breaks = seq(0, 100, by = 20)) +
theme_classic() +
theme(
panel.background = element_rect(fill="white", colour="white", size=0.25),
axis.line = element_line(colour="black", size=0.5),
axis.title = element_text(size=13, color="black"),
axis.text = element_text(size=12, color="black"),
legend.position = "right", #将图例放在右侧
legend.text = element_text(size =10),
aspect.ratio = 1,
plot.title = element_text(size = 10),
axis.text.x = element_text(angle = 45, hjust = 1),
legend.box.spacing = unit(0.1, "cm"),
#legend.key.width = 0.5,
legend.background = element_blank()
) +
guides(fill = guide_legend(reverse = TRUE), ncols = 1) #将图例用一列显示
阅读全文