Skip to content

Instantly share code, notes, and snippets.

@AmeliaMN
Created October 17, 2012 01:04
Show Gist options
  • Save AmeliaMN/3903158 to your computer and use it in GitHub Desktop.
Save AmeliaMN/3903158 to your computer and use it in GitHub Desktop.
R plotting example: Pole Position
# Data preparation
# Not included in this code snippet to respect the current proprietary nature of this research.
# Once research is to be reproduced, data preparation procedures will be made available.
#Plotting
plot(ypole, xpole, xlim=c(0.35, -0.12), ylim=c(0.15, -0.15), type="l", col="white", ylab="", xlab="", yaxt="n", xaxt="n")
axis(1, at=seq(from=0.35, to=-0.12, by=-0.05), labels=c(0.35, 0.3, 0.25, 0.2, 0.15, 0.1, 0.05, 0, -0.05, -0.1))
axis(2, at=seq(from=0.15, to=-0.15, by=-0.05), labels=c(0.15, 0.1, 0.05, 0, -0.05, -0.1, -0.15))
abline(v=seq(from=0.4, to=-0.17, length.out=58), col="green", lwd=0.3)
abline(h=seq(from=0.15, to=-0.15, length.out=31), col="green", lwd=0.3)
abline(v=seq(from=0.4, to=-0.17, by=-0.05), col="green")
abline(h=seq(from=0.15, to=-0.15, by=-0.05), col="green")
par(new=T)
plot(ypole, xpole, xlim=c(0.35, -0.12), ylim=c(0.15, -0.15), type="l", col="blue", ylab="", xlab="", yaxt="n", xaxt="n")
points(decadesy, decadesx, xlim=c(0.35, -0.12), ylim=c(0.15, -0.15), type="p", pch=1, col="black", ylab="", xlab="")
text(labelsy, labelsx, labels=seq(from=1850, to=2010, by=10), pos=c(1,1,2,4,4,3,1,4,3,2,4,1,4,4,4,3,4), cex=1)
lines(c(-0.0815, -0.085), c(-0.07, -0.065))
mtext(expression(paste(X*second%<-% displaystyle(T), "oward Greenwich",sep="")), side=2, line=3)
mtext(expression(paste(Y*second%<-% displaystyle(T), "oward ", 90 *degree, " West", sep="")), side=1, line=3)
categories <- expression(paste("Path of Mean Rotational Poles *"), paste("Decades"), paste("* Data supplied by Dr. Gambis, Director of EOP PC "), paste(" at the ", italic("Observatorie de Paris"), ", on 21 March 2011"))
legend(x="bottomright", categories, title=expression(bold("Trace and Decades")), col=c("blue", "black"), lty=c(1,0,0,0), lwd=c(2, 1,1,1), pch=c(-1, 1,-1, -1), cex=0.7, bty="o", bg="white", inset=c(0.01, 0.01))
par(new=T)
plot(c(1890, 2010), c(-0.008, 0.008), type="n", xlim=c(1890, 2010), ylim=c(-0.008, 0.008), ylab="", xlab="", yaxt="n", xaxt="n")
rect(1890, 0.0075, 1923, 0.0085, col="white")
text(1890, 0.0081, labels="PATH OF NORTH ROTATIONAL POLE", pos=4, cex=0.7)
text(1890, 0.0077, labels="1846 to JAN 18, 2011", pos=4, cex=0.6)
copyright.draw(" IfCG ", z, "BY-ND-2011", .08, .045, .4, fontsize=8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment