0
我做有R的曲線圖,用於堆積條形圖和軸線2是簡單的代碼,這裏是線與軸線4的代碼:ř情節,對於積值的變化刻度軸
lines(y,
theLineValues,
type = "o",
pch = 20,
lwd = 2,
cex = 1.2,
lty = 1,
col ="forestgreen")
axis(4,
at = getYaxis(0,1,0.01, 3), # function to get 3 values for axis
labels = getYaxis(0,1,0.01, 3),
col.axis= "forestgreen",
las = 1,
cex.axis= 0.7,
col = "forestgreen",
line = 0)
然後我發現最小值和最大值:0.46,0.68,並且想用它們作爲軸,所以線的變化可以更明顯地看到(紅線)。
labels = getYaxis(min(theLineValues),max(theLineValues),0.01,3),
我將如何縮放 'theLineValues' 要做到這一點?
謝謝。
============================================== ======================== 更新1:爲 'Y' 的代碼:
y <- barplot(
combinedvalues, # it's list of 3-combined values.
col = c("slategray1","darkseagreen1","moccasin"),
beside = FALSE,
border = "grey80",
las = 1,
cex.axis= 1.0,
ann = FALSE,
ylim = c(0,1),
yaxt = "n")
======== ================================================== ============ 更新2:合併值:
這些值在.csv文件中,並使用以下命令獲取'combinedvalues'並將其傳遞給'y':
rbind(csv$frame0,csv$frame1,csv$frame2)
# frame0+frame1+frame2 shoud be 1, theLineValues were calculated by some formulas.
csv文件:
frame0 frame1 frame2 theLineValues
------------------------------------------------------------
0.4460203874 0.2271394791 0.3268401336 0.4674583872
0.4473756948 0.2084173711 0.3442069341 0.4796977238
0.5296042291 0.1570493286 0.3133464423 0.570317484
0.5255498752 0.1234146373 0.3510354875 0.6095475721
0.5405768621 0.119299957 0.34.6251561825
0.5657840709 0.0916650587 0.3425508703 0.6896446583
0.4826617968 0.0877739789 0.4295642243 0.6610089801
0.3588171226 0.122977733 0.5182051444 0.606129318
0.2608499204 0.1705417922 0.5686082874 0.595971676
0.2111782825 0.2040231107 0.5847986067 0.6057364576
0.1731616573 0.240909341 0.5859290016 0.6153720603
謝謝。
============================================== ======================== 更新3:最後情節:
如果是baseplot嘗試ylim = C(分鐘(theLineValues),最大值(theLineValues)) – 2015-02-11 10:24:54
順便說一句。你能給y的值嗎? – 2015-02-11 10:35:19
y(堆疊的barplot)需要yllime = c(0,1) – Xiangwu 2015-02-11 10:53:52