我試圖在具有不同顏色的每個光譜的同一圖上繪製多個光譜。 我使用hyperSpec包和ggplot2中的'hyperSpec'對象。 我的數據集是相當大的,但它的一部分看起來像這樣:在超尺寸對象中用不同顏色繪製多個光譜
> dataTable
1_6-5p.asc 1_6-25p.asc 1_6-50p.asc 1_6-75p.asc 1_6-95p.asc
4000 98.35901 97.04647 98.65234 99.17536 97.11173
3999 98.35578 97.04401 98.65169 99.17371 97.11437
3998 98.35255 97.03779 98.65102 99.17253 97.11699
3997 98.34935 97.03048 98.65038 99.17188 97.12239
3996 98.34452 97.02479 98.64652 99.17108 97.12877
3995 98.33943 97.02187 98.64160 99.16943 97.13389
3994 98.33523 97.02140 98.63806 99.16646 97.13641
3993 98.33336 97.02289 98.63696 99.16242 97.13630
3992 98.33389 97.02617 98.63755 99.15876 97.13475
3991 98.33560 97.03071 98.63850 99.15775 97.13349
3990 98.33731 97.03488 98.63908 99.16082 97.13384
3989 98.33895 97.03685 98.63897 99.16680 97.13568
3988 98.34147 97.03625 98.63773 99.17248 97.13708
3987 98.34556 97.03472 98.63520 99.17517 97.13553
3986 98.35042 97.03425 98.63230 99.17450 97.13028
3985 98.35414 97.03502 98.63068 99.17167 97.12378
3984 98.35526 97.03520 98.63142 99.16771 97.12050
3983 98.35411 97.03351 98.63443 99.16319 97.12381
3982 98.35249 97.03137 98.63891 99.15940 97.13368
3981 98.35214 97.03208 98.64386 99.15863 97.14675
我的代碼繪製:
> spc <- new('hyperSpec',dataTable)
> p <- qplotspc(spc)
> p <- p + scale_x_reverse()
> print(p)
我嘗試添加自定義顏色的scale_x_manual但我不能」不要讓它工作,我對ggplot很新。
請幫助,謝謝!
它看起來像'hyperSpec'正在處理的每一行作爲一個單獨的光譜,而不是每一列。那是對的嗎? – eipi10
這是正確的,我也嘗試使用ggplot()而不將錶轉換爲每個光譜具有單獨geom_line()的'hyperSpec'對象,但是這也會產生相同的輸出並且我仍然無法添加顏色 –