i want to insert a text into my ggplot chart. The text got a subscript and a supersubscript like X[X} = 1,00*Y R^2 = 0,90. For that i used the funktion paste(expression()) into annotate(label=()). In the graphics pane the whole plot looks fine, like i needed. But if i want to save the plot into a svg using the svg.save function the plot missing the Axis and the annotate Text. Without annotate the whole svg is fine. So i guess, the soloution is fixing the paste(expression()) function. But i didnt found a solution for that.
Data <- read.csv2("Data.csv", header = TRUE, sep = ";", dec = ",")
Data$ï..Date <- as.Date(Data$ï..Date, format = "%d.%m.%Y")
Gesamt_Plot1 <- ggplot() +
geom_point(aes(X$EC,Y$BC), show.legend = FALSE, shape = 1, size = 1.5, na.rm = TRUE)+
geom_abline(linetype = "dashed")+
geom_segment(aes(x = 0.19,xend = 5.49, y = G1_slp*0.19, yend = G1_slp*5.49), color = "black", size = 1.2, na.rm = TRUE)+
annotate(geom="text", x = 4, y=6.4, parse = T, label=paste(expression(EBC~"="~"0,92*"*EC[TOR]~~R²~"="~"0,89")), color="black")+
annotate(geom="text", x=0.1, y=7, label="a)", color="black")+
labs(colour = "", x=expression(EC[TOR]~"in"~mu*g~m^-3), y=expression(EBC~"in"~mu*g~m^-3))+
theme_bw()+
theme(axis.text.y=element_text(size = 12), axis.text.x = element_text(size = 12),
axis.title = element_text(size = 12), legend.position = "bottom", panel.grid.minor = element_blank())+
scale_x_continuous(limit = c(0,7),
breaks = c(0, 1, 2, 3, 4, 5, 6, 7)
)+
scale_y_continuous(limit = c(0,7),
breaks = c(0, 1, 2, 3, 4, 5, 6, 7)
)
https://i.stack.imgur.com/9axhZ.png
Using R Version 4.0.5 and ggplot v3.3.3.