在R中,我繪製了以下直方圖。問題在X軸上。大部分數據落入區間[0,10]。很少有一個X值大於10,儘管最大值是34.如何將軸斷點設置爲軸的一部分?
因此,不是在X軸上一直顯示0,1,2,...直到34,我將顯示0 ,1,2,...,10,15,20,25,30.換句話說,當X> 10時,僅以5的間隔顯示標籤,以便標籤不會重疊。
這是我的R代碼。如何修改它?
d<-read.table("16_prop_s.tsv", header=T, sep="\t")
library(ggplot2)
library(scales)
ggplot(d, aes(x=factor(NRB))) +
geom_histogram(aes(y=(..count..)/sum(..count..))) +
scale_y_continuous(labels=percent_format()) +
xlab("Rotatable bonds") + opts(axis.title.y = theme_blank()) +
opts(axis.title.x = theme_text(size = 24)) +
opts(axis.text.x = theme_text(size = 18)) +
opts(axis.text.y = theme_text(size = 18))
我編輯了標題,以希望使更多的搜索。讓我知道你的想法。 – 2012-08-20 07:13:14
當然,沒關係。 – 2012-08-20 09:17:13