[英]decrease x-axis font on a plot in R
我想減小x軸的字體大小,使其適合國家/地區名稱。
我已經嘗試過cex
, cex.axis
, axis()
,但似乎沒有任何作用。 cex
和cex.axis
僅更改了Y軸。 這是我一直在使用的代碼。
plot(goldmanMF20to50$Location, xlab="Location", ylab="Number of Individuals",
col=4, main="Location of Individuals in the Goldman Osteometric Data Set
between 20 and 50", cex.main=0.6, las = 2, ylim=c(0, 150),)
這可能並不直接適用於此問題,但是使用日期時的解決方案是首先隱藏x軸標簽,然后使用axis.Date()命令繪制x軸。 這需要創建一個單獨的x軸數據集-在下面的示例中,這是在date文件中生成的。 這是繪制股票市場數據(S&P 500)的示例。 注意plot()中的xaxt =“ n”參數,以及通過cex.axis = 0.8在axis.Date()中相對較小的字體大小
library(quantmod)
getSymbols("^GSPC", src='yahoo', from='2013-12-31')
sp500 <-Ad(GSPC)
dates <-as.Date(index(sp500))
plot(dates,sp500, ylab = "",xlab="",xaxt="n",type="l")
axis.Date(side = 1, dates,at = dates,cex.axis=0.8,format = "%b-%d-%Y")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.