Hi dear all, the following code is correct. but I want to use non-numeric
x-axis, for example
if I replace time <- seq(0,72,6) by
month <-
c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Pag")
Ofcourse I use factor(month) instead of time; but I didn't get similar
plot as the example shown. any help is greatful ;)
month <-
c("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","Pag")
music <- c(0.05,0.18,0.25,0.31,0.32,0.34,0.35,
0.36,0.37,0.38,0.39,0.40,0.41)
actor <- c(0,1000,2000,3000,4000,5000,6000,7000,8000,9000,10000,11000,12000)
par(mar=c(5, 4, 4, 4) + 0.1)
plot(factor(month), music, pch=16, axes=F, ylim=c(0,1), xlab="", ylab="",
type="b",col="black", main="Enjoy")
axis(2, ylim=c(0,1),col="black")
mtext("Music",side=2,line=2.5)
box()
par(new=T)
plot(factor(month), actor, pch=15, xlab="", ylab="", ylim=c(0,13000),
axes=F, type="b", col="red")
mtext("Actor",side=4,col="red",line=2.5)
axis(4, ylim=c(0,13000), col="red",col.axis="red")
axis(1,pretty(range(month),10))
mtext("Month",side=1,col="black",line=2.5)
legend(5,13000,legend=c("Music","Actor"),text.col=c("black","red"),pch=c(16,15),col=c("black","red"))
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.