2017-01-22 83 views
0

我做了一個圖(見下文),並且可以看到tick上的值0不是從圖的開始處開始。 Tree diagram爲什麼我的刻度線設置的值不在軸上的值位置?

enter image description here

Tree<-as.vector(Site$`2617`$counts[1:183, 8]) 
RadioCarbon<-Site$`2617`$chronologies$`NAPD 1`$age 
Tree 

#turn to percentages 
x<-(Tree) 
M<-max(Tree, na.rm=FALSE) 
m<-min (Tree, na.rm = FALSE) 
Tree1<-((x-m)*100)/(M-m) 


#because we want a straight vertical left border to shade the diagram, 
#we add values (0) 
#to before and after the value sequence of x-axis (!) 

Tree2<-append(0,Tree1) 
Tree2<- append(Tree2, 0) 

#we want to add "partners" to the above values and just replicate the 
#first value and last value and modify the NAs 
RadioCarbon <-append(RadioCarbon[1],RadioCarbon) 
RadioCarbon 
t<- tail(RadioCarbon, n=1) 
RadioCarbon1<-append(RadioCarbon, t) 
RadioCarbon1<-rev(RadioCarbon1) 

#now we plot without labels 
RadioCarbon1 
plot(Tree2, RadioCarbon1, type="l", 
    xlab = expression('%pollen'~italic('Fagus grandifolia')), 
    yaxt = 'n', xaxt = 'n', ylab= "CalYears BP", 
    main = "Southern NY, Sutherland Pond", labels =FALSE) 


#creating x-axis labelling 
a <- c(0,25,50,75,100) 
axis(1, at = a, labels = a) 



#creating y-axis tick marks and labels (choose Values closest to 1000s) 


axis(2, at = seq(from = max(RadioCarbon1), to = 0, by = 1000), las=2) 
# 
ticksCal 
ticksCal<- seq(from = 0, to = max(RadioCarbon1), by = 1000) 
labelsCal<-as.character(ticksCal) 
labelsCal<-rev(labelsCal) 
axis(2, at = ticksCal, labels = labelsCal, las=1) 

數據

Tree <- 
    c(1, 2, 3, 8, 4, 5, 11, 9, 11, 5, 12, 19, 11, 4, 10, 17, 11, 
    5, 14, 19, 17, 26, 13, 10, 9, 18, 13, 14, 19, 14, 6, 14, 8, 11, 
    6, 15, 2, 22, 2, 13, 17, 13, 6, 24, 11, 13, 15, 12, 38, 22, 3, 
    29, 12, 19, 10, 6, 8, 20, 13, 11, 10, 15, 7, 5, 15, 13, 9, 12, 
    14, 10, 10, 13, 8, 11, 8, 12, 12, 5, 11, 7, 13, 8, 9, 12, 7, 
    8, 12, 9, 12, 19, 19, 17, 8, 8, 25, 26, 16, 20, 16, 30, 26, 3, 
    17, 16, 7, 9, 13, 22, 12, 0, 8, 8, 3, 4, 7, 8, 3, 1, 5, 4, 6, 
    2, 2, 1, 2, 1, 1, 0, 2, 1, 3, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 3, 1, 0, 1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0) 

RadioCarbon <- 
    c(44, 89, 133, 178, 258, 373, 489, 604, 720, 836, 951, 1067, 
    1182, 1298, 1413, 1529, 1644, 1760, 1876, 1991, 2036, 2069, 2102, 
    2134, 2167, 2200, 2232, 2265, 2297, 2330, 2363, 2395, 2428, 2460, 
    2493, 2526, 2558, 2591, 2624, 2673, 2738, 2803, 2869, 2934, 3000, 
    3065, 3130, 3196, 3261, 3326, 3392, 3457, 3522, 3588, 3653, 3718, 
    3784, 3849, 3915, 3980, 4014, 4047, 4080, 4114, 4148, 4181, 4214, 
    4248, 4282, 4315, 4348, 4382, 4416, 4449, 4482, 4516, 4550, 4583, 
    4616, 4650, 4712, 4774, 4836, 4898, 4960, 5022, 5084, 5146, 5208, 
    5270, 5333, 5395, 5457, 5519, 5581, 5643, 5705, 5767, 5829, 5913, 
    6020, 6127, 6233, 6340, 6447, 6553, 6660, 6767, 6873, 6980, 7087, 
    7193, 7300, 7407, 7513, 7620, 7727, 7833, 7940, 8047, 8153, 8260, 
    8367, 8473, 8580, 8687, 8793, 8900, 9007, 9113, 9220, 9327, 9433, 
    9540, 9566, 9591, 9617, 9630, 9793, 9957, 10120, 10274, 10429, 
    10583, 10737, 10891, 11046, 11200, 11375, 11550, 11725, 11900, 
    12075, 12250, 12425, 12600, 12775, 12950, 13125, 13475, 13825, 
    14525, 15225, 15925, 16625, 17325, 18025, 18725, 19425, 20125, 
    20825, 21525, 22225, 22925, 23625, 24325, 25025, 25725, 26425, 
    27125, 27825, 28525, 29225) 

現在用放射性碳44之後結束,爲什麼不是最後一跳以上爲0值?我也嘗試使用0作爲最後一個值,但它也不起作用。我最終應該從44開始?但是,那麼我怎麼能夠在每個偶數(多個)千位數上產生一個均勻的間距?

謝謝!

+1

能否請您包括生成實際情節的代碼? – G5W

+0

是否這樣?我把數據放在 –

+0

是的 - 這有幫助。 – G5W

回答

0

您的數據上升到29225,但您的比例只能達到29000.因爲這反過來,29000標籤結束在軸0位置,而您的0標籤結束在29000位置。最快&最簡單的解決方案只是調整標籤位置,如

axis(2, at = ticksCal + 225, labels = labelsCal, las=1) 

所以,這由一個移動的標籤組成軸過剩的規模以上29000,即225點