2012-05-30 24 views
1

我在R中的以下情節:如何完善以下R圖?

x = c(0, 1e-10, 1e-08, 1e-06, 1e-05, 0.001, 0.1); 
y = c(22000, 21490, 17252, 9204, 6118, 5092, 4998); 
z = c(85.59, 85.59, 85.58, 85.49, 85.29, 85.29, 85.29); 

x1 = c(0, 1e-10, 1e-08, 1e-06, 1e-05, 0.001, 0.1); 
y2 = c(22000, 20039, 15185, 7705, 5436, 5223, 4933); 
z2 = c(85.59, 85.59, 85.58, 85.53, 85.46, 85.49, 85.49); 

y = y/60; 

y2 = y2/60; 


x = log(x); 

par("mar") 
par(mar = c(par("mar")[1:3], 5.1)) 

plot(x,y, type="n", lwd=4, ylab="", xlab="threshold", xaxt="n",yaxt="n") 

axis(1,lwd=4) 
axis(2,lwd=4) 

points(x, y, type = "l", lwd=4) 

points(x, y, col="red", cex=2, pch=19) 

points(x, y2, lwd=4, type="o", lty=2, col="black"); 

points(x, y2, col="red", cex=2, pch=19); 

par("usr") 
par(usr = c(par("usr")[1:2], 84,86)) 

axis(4, lwd=4) 
points(x, z, type="l", lwd=4) 

points(x, z, col="blue", cex=2, pch=15) 

points(x, z2, type="l", col="black", lty=2, lwd=4) 

points(x, z2, col="blue", cex=2, pch=15) 


mtext("Measure1", side = 4, col = "blue",line=3) 
mtext("Measure2", side = 2, col = "red",line=3) 

這對我來說幾乎是完美的,但我只是想按照下面的事情就來調整:

  1. 左邊的Y軸和x軸 - 他們更大膽,但由於某些原因,大膽部分未拉伸所有在軸。

  2. 我要讓數字和標籤有點大,也許粗體字體的字體。

  3. 我甚至可能要更改字體爲Times,但它聽起來好像很多的麻煩,從我在網上看到。

謝謝!

+2

1'box'是你的朋友 - 如果你加上'LWD = 4'和'type =「l」'作爲選項。 2.「帕爾」是你的朋友。在軸聲明''cex.lab'and將cex.axis'解決這個問題,我認爲。不確定我的頭頂。 – thelatemail

回答

0

正如上述評論,您的第一個問題可以通過功能box回答mentionned由@thelatemail:

box(lwd=4) 

如果希望只與軸兩側,以大膽,那麼你要添加一個bty參數:

box(lwd=4, bty="u") # For all the different kind of boxes see ?par. 

要更改字體,你必須在你的使用參數fontcex.labcex.axis標籤的大小210點axis聲明:

axis(1, font=2, cex.axis=1.1) #font=2 correspond to bold face. See ?par for more information 

而且finaly的字體,你可以使用參數family,但它會與各種輸出設備的工作方式不同。您將在?x11節「字體」,並在this answer找到關於這一主題的更多信息。

axis(1, family="Times") #This will work with Cairo devices for example. 

這裏是cex.axis你的情節在1.1設置,字體加粗,並在時代字體加粗U形框和: enter image description here