I am a python user relatively new to R. I have the following code that draws this graph:
meangf <- c(-0.4183021,-0.4160919, -0.4140347, -0.4121201, -0.4103434, -0.4087048, -0.4058971, -0.4047143, -0.4036499, -0.4026888, -0.4018101, -0.4009911)
meanef <- c(-0.4368967, -0.4361810, -0.4354082, -0.4345807, -0.4337014, -0.4327733, -0.4308227, -0.4298084, -0.4287604, -0.4276822, -0.4265775, -0.4254498)
meanbf <- c(-0.3754438, -0.3808981, -0.3762082, -0.3688898, -0.3645197, -0.3613621, -0.3585380, -0.3562512, -0.3553108, -0.3545954, -0.3540907, -0.3536820)
x <- c(2685, 2754, 2825, 2898, 2973, 3050, 3207, 3287, 3369, 3453, 3539, 3627)
matplot(x, cbind(meangf, meanef, meanbf), col=c(4,2,3), type="l",lty=c(1,1,1) ,xlab="Bandwidth", ylab="Mean", main="Age25_44 Estimate Parameter")
legend("topright",legend=c("Gaussian Fixed", "Expnential Fixed", "Boxcar Fixed"), lty=c(1,1,1),lwd=2
,col=c(4,2,3),
ncol=3,bty="n",cex=0.8,
text.col=c(4,2,3),inset=0.01)
I would like to add a second x-axis on top of the graph such as
x2 <- c(20000, 22000, 24000, 26000, 28000, 30000, 32000, 34000, 36000, 38000, 40000, 42000)
How can I do that?
EDIT:
The solution I,d like is something similar to this question How to add a second x-axis in matplotlib
You may use axis()
.
where = seq(from=min(x), to=max(x), length.out=length(x2))
axis(1, where, labels=x2, padj=2)
padj
will let you place the axis down further