
数据下载链接见文章顶部
数据:

library(readxl)
data <- read_excel("fig3_line.xlsx", sheet = "Sheet1")
library(ggplot2)
pic =
ggplot(data, aes(x = x, y = y, group = Species, color = Species)) +
geom_line(linewidth = 1.5) +
# 主题设置
theme_classic() +
# 轴设置
theme(axis.text = element_text(size = 20)) +
theme(axis.title = element_text(size = 22)) +
coord_cartesian(xlim = c(0, 10)) +
ylab("Percent") +
xlab("Production") +
scale_y_continuous(labels = scales::percent) +
scale_x_continuous(breaks = seq(0, 10, by = 2)) +
# 图例设置
theme(legend.title = element_blank()) +
theme(legend.text = element_text(size = 18, face = "italic")) +
theme(legend.position = c(.68, .78)) +
# 颜色
scale_color_manual(values = c('#73c0de', '#5470C6', '#3ba272', '#fac858', '#ee6666', '#fc8452', '#9a60b4', '#ea7ccc'))
jpeg(filename = "test3.png", width = 3300, height = 3000, res = 600, quality = 100)
pic
dev.off()
library(ggplot2)
pic =
ggplot(data, aes(x = x, y = y, group = Species, color = Species)) +
geom_line(linewidth = 1.5)
theme_classic()
theme(axis.text = element_text(size = 20)) +
theme(axis.title = element_text(size = 22)) +
coord_cartesian(xlim = c(0, 10)) +
ylab("Percent") +
xlab("Production") +
scale_y_continuous(labels = scales::percent) +
scale_x_continuous(breaks = seq(0, 10, by = 2)) +
theme(legend.title = element_blank()) +
theme(legend.text = element_text(size = 18, face = "italic")) +
theme(legend.position = c(.68, .78))
scale_color_manual(values = c('#73c0de', '#5470C6', '#3ba272', '#fac858', '#ee6666', '#fc8452', '#9a60b4', '#ea7ccc'))
jpeg(filename = "test3.png", width = 3300, height = 3000, res = 600, quality = 100)
pic
dev.off()