Dear R users, I used plot() and mtext() functions to draw a plot. The numbers: 0,20,35, 40,60,80,100 were in the vertical direction. I'd like to transfer them into the horizontal direction. plot(0,0,xaxt="n",type="n", ylim=c(0,100)) mtext("35",side=2,at=35) Any suggestion? Thanks. Rebecca [[alternative HTML version deleted]]
try par(las=1) plot(0,0,xaxt="n",type="n", ylim=c(0,100)) mtext("35",side=2,at=35) you can use 'las=1' in par(), plot(), axis(), etc. more generally, you can use 'srt' in text() to rotate tick labels: plot(1:10,1:10,xaxt="n",type="n", yaxt="n",ylim=c(0,100)) axis(1); axis(2,lab=FALSE) text(x=par("usr")[1]-2*par("cxy")[1],y=axTicks(2), lab=axTicks(2),xpd=TRUE,srt=45) --- Rebecca Ding <hydinghua at gmail.com> wrote:> Dear R users, > > I used plot() and mtext() functions to draw a plot. The numbers: 0,20,35, > 40,60,80,100 were in the vertical direction. I'd like to transfer them into > the horizontal direction. > > plot(0,0,xaxt="n",type="n", ylim=c(0,100)) > mtext("35",side=2,at=35) > > Any suggestion? > > Thanks. > > Rebecca > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >
?par see las This should work ------------------------------------------- plot(0,0,xaxt="n", type="n", ylim=c(0,100), las=1, ) mtext("35",side=2,at=35, line =1, las=1) ------------------------------------------- --- Rebecca Ding <hydinghua at gmail.com> wrote:> Dear R users, > > I used plot() and mtext() functions to draw a plot. > The numbers: 0,20,35, > 40,60,80,100 were in the vertical direction. I'd > like to transfer them into > the horizontal direction. > > plot(0,0,xaxt="n",type="n", ylim=c(0,100)) > mtext("35",side=2,at=35) > > Any suggestion? > > Thanks. > > Rebecca > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >