Вопрос

I tried to plot a horizontal y label using the following code:

require(grDevices)

par(mfrow=c(2,1), mar=c(0,3,0,0.5)+0.1, oma=c(3,0,0.5,0)+0.1, 
    mgp=c(2,1,0), cex=tcex)
par(las=1)
#pl-d001
plot(1, type="n", yaxt='n', xaxt='n', xaxs="i", yaxs="i", xlab="xlabel", 
     ylab=expression("axis "*italic(r[infinity])), xlim=c(0, 0.4), ylim=c(0, 1))

But, I only get a normal (vertical) Y label. What is wrong here?

enter image description here

Это было полезно?

Решение

As @rawr said in the comments, your best chance is with mtext:

plot(1, type="n", yaxt='n', xaxt='n', xaxs="i", yaxs="i", 
     xlab="xlabel", ylab="", xlim=c(0, 0.4), ylim=c(0, 1))
mtext(expression("axis "*italic(r[infinity])),side=2,las=1,line=1)

The reason why you can't do that directly from plot is that, internally, plot uses title to draw those labels and title (for some reason) doesn't take las or srt as arguments.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top