[R] problem with tick graph
n.vialma at libero.it
n.vialma at libero.it
Fri Dec 16 12:02:24 CET 2011
Dear all,
I'm having problems with the tick of my graph. I'mpcombining lines and
barplot.
For my I'm using the function axis combined with the function pretty to have
more efficient tick, but all my tick (for example, 300 as my max tick and -100
as my min tick) are not printed on my graph.
So I would like to have for the left axis the seq from 0 to 100 (with 0 and
100 printed on my graph) and for the right axis the seq from -100 to 300 (with
-100 and 300 printed on my graph)
Someone Knows how to get it???
The code and data are:
grafico<-{
pdf(file=file, paper="special",width=30, height=20)
par(bg="white",font=3,font.axis=3,las=1,cex.axis=2.2, mar=c(8,6,8,8)+8)
barplot(Imp$TassoV, width=10,space=c(0,0.1),legend.text = FALSE,beside=TRUE,
border="grey40", main="",col="midnightblue",cex.main=2.4,
axes = FALSE, axisnames =FALSE)
lab=as.character(pretty(Imp$TassoV))
axis(side=4,at=pretty(Imp$TassoV),labels=lab,cex.axis=2.4)
par(new=T)
chart.TimeSeries(Imp$ValueA, type="l", lwd=8, main="", ylab="", xlab="", date.
format="%y",
col="red3",major.ticks="years",minor.ticks=TRUE, grid.color="grey50", grid.
lty="dotted", cex.axis=2.4,yaxis=FALSE)
axis(2,at=c(pretty(Imp$ValueA)))
legend("topleft",c("Livelli mln $ (sc. sx)","Tasso di var. (sc.dx)"),col=c
("red3", "midnightblue"),bty="n",lwd=4,cex=2.4)
}
dev.off()
ValueA ValueA_L TassoV
1995-12-16 88.06557 NA NA
1996-12-16 88.34237 88.06557 0.3143044
1997-12-16 57.86447 88.34237 -34.4997529
1998-12-16 50.19389 57.86447 -13.2561039
1999-12-16 23.06846 50.19389 -54.0412943
2000-12-16 45.79965 23.06846 98.5379304
2001-12-16 22.35262 45.79965 -51.1947722
2002-12-16 66.89223 22.35262 199.2589371
2003-12-16 89.24867 66.89223 33.4215852
2004-12-16 77.16459 89.24867 -13.5397854
2005-12-16 51.23656 77.16459 -33.6009462
2006-12-16 49.51073 51.23656 -3.3683450
2007-12-16 90.39337 49.51073 82.5732837
2008-12-16 38.84831 90.39337 -57.0230554
2009-12-16 14.70859 38.84831 -62.1384086
2010-12-16 55.23819 14.70859 275.5505995
Thanks for your attention
More information about the R-help
mailing list