sorry for the stupid question, I've been unable to solve it even after googleing for a while. I KNOW I can produce plots with superscripts in the axis labels in a simple way like this one:
dta <- data.frame(LON = runif(20, -10, 10), LAT = runif(20, -10, 10))
plot(dta, xlim = c(-10,10), ylim = c(-10,10), axes = F)
axis(1, at = seq(-10,10,2), labels = paste0(abs(seq(-10,10,2)), "º"))
axis(2, at = seq(-10,10,2), labels = paste0(abs(seq(-10,10,2)), "º"), las = 2)
However, what I actually need is something like this one:
I made this one using Photoshop, but I'm iteratively producing tons of plots and this solution is not affordable. Please, pay attention to the fact that (1) both super- and subscripts are vertically aligned, (2) the subscripts are italicized, and (3) the subscripts are variable. I tried to fix the situation through "overwriting" the axis with commands like:
mtext(c(rep("S",6), "",rep("N",6)), side = 2, line = -0.2, outer = FALSE,
at = seq(-10,10,2)-0.4, font = 3, cex = 0.3, las = 2)
However, it's a pain in the... each time I decide to change the plot's resolution or size, because they are slow to be produced, and I have to do several until getting the adequated amount in "line". Can anybody throw some light on me to solve this, please?
vec <- seq(-10,10,2)
plot(dta, xlim = c(-10,10), ylim = c(-10,10), axes = F)
axis(1, at=vec, labels=as.expression(mapply(function(num,sub) bquote(.(num)[italic(.(sub))]^degree), abs(vec), ifelse(vec > 0, "E", ifelse(vec < 0, "W", "")))))
axis(2, at=vec, labels=as.expression(mapply(function(num,sub) bquote(.(num)[italic(.(sub))]^degree), abs(vec), ifelse(vec > 0, "N", ifelse(vec < 0, "S", "")))), las=2)