I'm asking for your advice and support to plot two lines of data using the geom_line and geom_area f(x) in Rstudio. It's pretty simple, but I can't fix the bugs from the final plot. I will appreciate your help!
The code that I'm using is described as follows:
`ggplot(data, aes(Strain,Stress, colour=Treatment))+ geom_point(aes(), size= 1.5, linetype="dotted")+ geom_area(aes(), alpha=0.2)+ xlim(0,0.01)+ylim(0,0.003)+ theme( line = element_line(colour = "black", size = 1, linetype = 1, lineend = "butt"), rect = element_rect(fill = "white", colour = "black", size = 1, linetype = 1), aspect.ratio = 1, plot.background = element_rect(fill = "white"), plot.margin = margin(1, 1, 1, 1, "cm"),
axis.text = element_text(size = rel(2.5), colour = "#000000", margin = 1),
strip.text = element_text(size = rel(0.8)),
axis.line = element_blank(),
axis.text.x = element_text(vjust = 0.2),
axis.text.y = element_text(hjust = 1),
axis.ticks = element_line(colour = "#000000", size = 1.2),
axis.title.x = element_text(size = 30, vjust=0.5),
axis.title.y = element_text(size = 30, angle = 90),
axis.ticks.length = unit(0.15, "cm"),
legend.background = element_rect(colour = NA),
legend.margin = unit(0.15, "cm"),
legend.key = element_rect(fill = "grey95", colour = "white"),
legend.key.size = unit(1.2, "lines"),
legend.key.height = NULL,
legend.key.width = NULL,
legend.text = element_text(size = rel(2.0)),
legend.text.align = NULL,
legend.title = element_text(size = rel(2.0), face = "bold", hjust = 0),
legend.title.align = NULL,
legend.position = "bottom",
legend.direction = NULL,
legend.justification = "center",
legend.box = NULL,
panel.background = element_rect(fill = "#ffffff", colour = "#000000",
size = 2, linetype = "solid"),
panel.border = element_rect(colour = "black", fill=NA, size=2),
)+ ylab("Stress(MPa)") + xlab("Strain")`
The result is a estrange plot:
The expected images is the two plot in the same graph, where the x and y scales are the same, like a good way to compare. The expected plot is shown:
Data:
https://drive.google.com/drive/folders/1QB0DfFwhKEm7ic6QQK3Ah6ARrtL1NOI4?usp=share_link