[R] no y-axis
Jim Lemon
jim at bitwrit.com.au
Wed Nov 14 08:01:38 CET 2012
On 11/13/2012 11:01 PM, Geophagus wrote:
> Hi Jim and thanks for your answer.
> It does not work how I want. When I use your proposal, the values are
> superimposed like shown on the pic.
>
> pic.png<http://r.789695.n4.nabble.com/file/n4649368/pic.png>
>
> Thats my code (what I need is a y-scale with the following interrupts:
> 5,10,100,1000,5000):
>
Hi Geo,
I see. Try this:
plot(BE_UK_ABFG$year, BE_UK_ABFG$ammo,
type="s",
col= "#DB270F",
yaxs="i",
xaxt="n",
yaxt="n",
ylim=c(0,5000),
xlab="",
ylab="",
main="Ammo Rep 1885b",
adj=0,
las = 1,
lwd=3,
bty="n"
)
abline(h=0:0, lwd=1, col="black")
abline(h=1000:1000, lwd=0.3, col="darkgray", lty="dashed")
abline(h=2000:2000, lwd=0.3, col="darkgray", lty="dashed")
abline(h=3000:3000, lwd=0.3, col="darkgray", lty="dashed")
abline(h=4000:4000, lwd=0.3, col="darkgray", lty="dashed")
abline(h=5000:5000, lwd=0.3, col="darkgray", lty="dashed")
lines (BE_UK_AW$year, BE_UK_AW$ammo, type="s", col= "#826A9F", lwd=3.5)
library(plotrix)
axis(1,at=2007:2010)
axis(2,at=seq(0,5000,by=1000),labels=c("",seq(1000,5000,by=1000)),las=1)
mtext(c(5,10,100),at=c(-150,0,150),line=1,side=2,las=1)
par(xpd=TRUE)
# get rid of the bottom tick
rect(2006.8,-10,2006.87,10,col="white",border=NA)
segments(rep(2006.8,3),c(-150,0,150),rep(2006.88,3),c(5,10,100))
par(xpd=FALSE)
Jim
More information about the R-help
mailing list