构造点图时,从phylo4d类的物种名称中删除下划线

时间:2019-05-09 20:40:43

标签: r phylogeny

我已经使用dotplot.phylo4d包创建了一个phylosignal。在使用物种名称时,它要求下划线将属和物种分开,例如:Genus_species,但是在树本身上,尖端节点应该在没有此下划线的情况下出现,但不是。我尝试调整underscore参数,但没有运气。

以下是制作树的代码:

library("phylosignal")
dotplot.phylo4d(local, dot.col=points.col, dot.pchFpoints.pch, underscore=TRUE, 
                trait.labels=c("Water Repellency", "Barb Stiffness"), trait.bg.col="white")

我尝试手动添加tip.lables,但是它没有将物种放置在正确的位置。当我尝试从local phylo4d类提取标签名称时,出现错误:Error in local$lable : $ operator not defined for this S4 class

有人有什么想法吗?

以下是dput(local)

的示例
new("phylo4d", data = structure(list(water_repelency_factor = c(0.406853948726056, 
0.607154878704302, 0.650989064481201, 0.124886215381352, 0.0723507857767838, 
-0.0723167215080719, 0.013459653778258, -1.78914935357281, -0.564983339285733, 
0.606337089022796, 0.659663703834298, 0.0176228716122535, 0.0127574040830885, 
-0.196395841638203, -0.0459106519882355, -0.00530956412638191, 
0.639508124725596, 0.777990116847955, 0.451610618568295, 0.355696905949063, 
0.263869048235165, -0.221564237669859, 0.147157051369543, 0.117382140996346, 
0.0780014518176963, -0.0432113445007319, 1.63762850650646, 3.18758974791682, 
3.1915764230193, 2.59818280850751, 0.13012860558643, 0.438800747071309, 
0.220659982250533, 0.0406142785151005, -0.0966974465314274, 0.123091856737923, 
-0.00273950242722704, -0.0440442594202772, -0.018999718854047, 
-0.0913244261412157, 0.425022676610531, 0.632243165802067, 0.368361182363585, 
-0.00812059600733897, -0.147599248089371, 0.0148070440392808, 
-0.16383227579288, 0.276110714945516, 0.232486022888682, 0.120444921178624, 
0.0247910093458199, 0.0199371653665217, 0.0137880171357138, -0.00359380232761909, 
-0.135584983429275, 0.824091682655614, 0.589492230611259, -0.386326654254213, 
0.656926986174162, 0.647598093829388, 1.10465298748181, 1.08603679621794, 
0.185419991568835, 0.536392662698255), stiffness_parameter = c(-0.451152645392232, 
-0.0675275753134292, -0.365241405962641, 0.0905545163858439, 
0.288842041901916, 0.266165143212233, 0.136623204129795, 0.0897899100887545, 
0.165206538251347, 0.115331641755025, 0.0705395185451837, 0.00977078724881693, 
0.25245123194264, 0.600773298772429, 0.589060413404627, -0.403924106606226, 
0.0347747504905809, 0.0413013238266368, 0.0719688786031885, 0.0546088786069706, 
-0.468432315476859, -0.145643606900637, 0.366171679501629, 0.312574773140502, 
0.0838000268770967, 0.0810893539547085, 1.08795895425903, 2.06681624860963, 
2.02014470904867, 1.67845452279315, -0.00619064668359723, 0.064525330741118, 
0.0321501505674897, -0.148400036867211, -0.374596029376242, 0.000137596835294316, 
0.00173620676450802, -0.252397879000816, 0.141994990326184, 0.147348381636395, 
-0.505048807104088, -0.461332473091121, -0.121426983017065, -0.136696496034141, 
-0.146453001600327, -0.393612849002826, -0.401688658534651, -0.131022632470828, 
-0.0516916448217204, 0.0447178990330358, -0.00917528749341404, 
-0.0645128131411127, 0.0230480464064479, -0.0807760835928284, 
-0.211124585904092, 0.0742996834809848, 0.393936005786656, -0.178168184216292, 
0.496357516284941, 0.218262874943631, 1.67041563314074, 1.67041563314074, 
-0.0264417662148244, 0.170746918626684)), row.names = c(NA, 64L
), class = "data.frame"), metadata = list(), edge = structure(c(0L, 
65L, 66L, 67L, 67L, 68L, 68L, 66L, 69L, 69L, 65L, 70L, 71L, 71L, 
70L, 72L, 73L, 74L, 75L, 76L, 77L, 77L, 78L, 79L, 79L, 78L, 80L, 
80L, 76L, 81L, 81L, 82L, 82L, 83L, 83L, 75L, 84L, 84L, 85L, 85L, 
86L, 87L, 87L, 86L, 88L, 88L, 74L, 89L, 90L, 91L, 91L, 92L, 92L, 
93L, 93L, 90L, 94L, 94L, 95L, 95L, 96L, 96L, 89L, 97L, 97L, 98L, 
98L, 73L, 99L, 100L, 101L, 102L, 102L, 101L, 103L, 103L, 100L, 
104L, 104L, 105L, 105L, 99L, 106L, 107L, 108L, 108L, 107L, 109L, 
109L, 110L, 110L, 106L, 111L, 112L, 113L, 113L, 112L, 114L, 114L, 
111L, 115L, 115L, 116L, 117L, 117L, 118L, 118L, 116L, 119L, 119L, 
72L, 120L, 120L, 121L, 122L, 122L, 123L, 123L, 124L, 124L, 121L, 
125L, 125L, 126L, 126L, 127L, 127L, 65L, 66L, 67L, 1L, 68L, 2L, 
3L, 69L, 4L, 5L, 70L, 71L, 6L, 7L, 72L, 73L, 74L, 75L, 76L, 77L, 
12L, 78L, 79L, 8L, 9L, 80L, 10L, 11L, 81L, 16L, 82L, 13L, 83L, 
14L, 15L, 84L, 22L, 85L, 21L, 86L, 87L, 17L, 18L, 88L, 19L, 20L, 
89L, 90L, 91L, 26L, 92L, 25L, 93L, 23L, 24L, 94L, 27L, 95L, 30L, 
96L, 28L, 29L, 97L, 31L, 98L, 32L, 33L, 99L, 100L, 101L, 102L, 
34L, 35L, 103L, 36L, 37L, 104L, 38L, 105L, 39L, 40L, 106L, 107L, 
108L, 41L, 42L, 109L, 43L, 110L, 44L, 45L, 111L, 112L, 113L, 
46L, 47L, 114L, 48L, 49L, 115L, 50L, 116L, 117L, 53L, 118L, 51L, 
52L, 119L, 54L, 55L, 120L, 64L, 121L, 122L, 56L, 123L, 59L, 124L, 
57L, 58L, 125L, 63L, 126L, 60L, 127L, 61L, 62L), .Dim = c(127L, 
2L), .Dimnames = list(NULL, c("ancestor", "descendant"))), edge.length = c(`0-65` = NA, 
`65-66` = 0.936507936507937, `66-67` = 0.0317460317460317, `67-1` = 0.0317460317460317, 
`67-68` = 0.0158730158730159, `68-2` = 0.0158730158730159, `68-3` = 0.0158730158730159, 
`66-69` = 0.0476190476190476, `69-4` = 0.0158730158730159, `69-5` = 0.0158730158730159, 
`65-70` = 0.0793650793650794, `70-71` = 0.904761904761905, `71-6` = 0.0158730158730159, 
`71-7` = 0.0158730158730159, `70-72` = 0.0317460317460317, `72-73` = 0.142857142857143, 
`73-74` = 0.349206349206349, `74-75` = 0.174603174603175, `75-76` = 0.0952380952380952, 
`76-77` = 0.0634920634920635, `77-12` = 0.0634920634920635, `77-78` = 0.0158730158730159, 
`78-79` = 0.0317460317460317, `79-8` = 0.0158730158730159, `79-9` = 0.0158730158730159, 
`78-80` = 0.0317460317460317, `80-10` = 0.0158730158730159, `80-11` = 0.0158730158730159, 
`76-81` = 0.0793650793650794, `81-16` = 0.0476190476190476, `81-82` = 0.0158730158730159, 
`82-13` = 0.0317460317460317, `82-83` = 0.0158730158730159, `83-14` = 0.0158730158730159, 
`83-15` = 0.0158730158730159, `75-84` = 0.142857142857143, `84-22` = 0.0793650793650794, 
`84-85` = 0.0158730158730159, `85-21` = 0.0634920634920635, `85-86` = 0.0158730158730159, 
`86-87` = 0.0317460317460317, `87-17` = 0.0158730158730159, `87-18` = 0.0158730158730159, 
`86-88` = 0.0317460317460317, `88-19` = 0.0158730158730159, `88-20` = 0.0158730158730159, 
`74-89` = 0.238095238095238, `89-90` = 0.0476190476190476, `90-91` = 0.0634920634920635, 
`91-26` = 0.0476190476190476, `91-92` = 0.0158730158730159, `92-25` = 0.0317460317460317, 
`92-93` = 0.0158730158730159, `93-23` = 0.0158730158730159, `93-24` = 0.0158730158730159, 
`90-94` = 0.0634920634920635, `94-27` = 0.0476190476190476, `94-95` = 0.0158730158730159, 
`95-30` = 0.0317460317460317, `95-96` = 0.0158730158730159, `96-28` = 0.0158730158730159, 
`96-29` = 0.0158730158730159, `89-97` = 0.126984126984127, `97-31` = 0.0317460317460317, 
`97-98` = 0.0158730158730159, `98-32` = 0.0158730158730159, `98-33` = 0.0158730158730159, 
`73-99` = 0.412698412698413, `99-100` = 0.238095238095238, `100-101` = 0.0476190476190476, 
`101-102` = 0.0317460317460317, `102-34` = 0.0158730158730159, 
`102-35` = 0.0158730158730159, `101-103` = 0.0317460317460317, 
`103-36` = 0.0158730158730159, `103-37` = 0.0158730158730159, 
`100-104` = 0.0634920634920635, `104-38` = 0.0317460317460317, 
`104-105` = 0.0158730158730159, `105-39` = 0.0158730158730159, 
`105-40` = 0.0158730158730159, `99-106` = 0.111111111111111, 
`106-107` = 0.158730158730159, `107-108` = 0.0476190476190476, 
`108-41` = 0.0158730158730159, `108-42` = 0.0158730158730159, 
`107-109` = 0.0317460317460317, `109-43` = 0.0317460317460317, 
`109-110` = 0.0158730158730159, `110-44` = 0.0158730158730159, 
`110-45` = 0.0158730158730159, `106-111` = 0.0793650793650794, 
`111-112` = 0.0952380952380952, `112-113` = 0.0317460317460317, 
`113-46` = 0.0158730158730159, `113-47` = 0.0158730158730159, 
`112-114` = 0.0317460317460317, `114-48` = 0.0158730158730159, 
`114-49` = 0.0158730158730159, `111-115` = 0.0634920634920635, 
`115-50` = 0.0793650793650794, `115-116` = 0.0158730158730159, 
`116-117` = 0.0317460317460317, `117-53` = 0.0317460317460317, 
`117-118` = 0.0158730158730159, `118-51` = 0.0158730158730159, 
`118-52` = 0.0158730158730159, `116-119` = 0.0476190476190476, 
`119-54` = 0.0158730158730159, `119-55` = 0.0158730158730159, 
`72-120` = 0.761904761904762, `120-64` = 0.126984126984127, `120-121` = 0.0158730158730159, 
`121-122` = 0.0634920634920635, `122-56` = 0.0476190476190476, 
`122-123` = 0.0158730158730159, `123-59` = 0.0317460317460317, 
`123-124` = 0.0158730158730159, `124-57` = 0.0158730158730159, 
`124-58` = 0.0158730158730159, `121-125` = 0.0634920634920635, 
`125-63` = 0.0476190476190476, `125-126` = 0.0158730158730159, 
`126-60` = 0.0317460317460317, `126-127` = 0.0158730158730159, 
`127-61` = 0.0158730158730159, `127-62` = 0.0158730158730159), 
    label = c(`1` = "Anhima_cornuta", `2` = "Alopochen_aegyptiaca", 
    `3` = "Anas_undulata", `4` = "Francolinus_coqui", `5` = "Meleagris_gallopavo", 
    `6` = "Pterocles_namaqua", `7` = "Streptopelia_lugens", `8` = "Anhinga_melanogaster", 
    `9` = "Phalacrocorax_capensis", `10` = "Morus_bassanus", 
    `11` = "Morus_capensis", `12` = "Fregata_minor", `13` = "Threskiornis_aethiopicus", 
    `14` = "Ephippiorhynchus_senegalensis", `15` = "Mycteria_ibis", 
    `16` = "Gavia_immer", `17` = "Pterodroma_macroptera", `18` = "Procellaria_cinerea", 
    `19` = "Halobaena_caerulea", `20` = "Pelecanoides_urinatrix", 
    `21` = "Thalassarche_chlororhynchos", `22` = "Hydrobates_pelagicus", 
    `23` = "Pelecanus_occidentalis", `24` = "Pelecanus_rufescens", 
    `25` = "Pelecanus_onocrotalus", `26` = "Scopus_umbretta", 
    `27` = "Pygoscelis_papua", `28` = "Spheniscus_demersus", 
    `29` = "Spheniscus_magellanicus", `30` = "Eudyptes_chrysocome", 
    `31` = "Egretta_garzetta", `32` = "Ardea_melanocephala", 
    `33` = "Ardea_cinerea", `34` = "Fulica_cristata", `35` = "Podica_senegalensis", 
    `36` = "Aramus_guarauna", `37` = "Grus_paradisea", `38` = "Phoenicopterus_ruber", 
    `39` = "Podiceps_nigricollis", `40` = "Tachybaptus_ruficollis", 
    `41` = "Chionis_albus", `42` = "Burhinus_capensis", `43` = "Charadrius_marginatus", 
    `44` = "Recurvirostra_avosetta", `45` = "Haematopus_moquini", 
    `46` = "Numenius_arquata", `47` = "Phalaropus_fulicarius", 
    `48` = "Actophilornis_africanus", `49` = "Rostratula_benghalensis", 
    `50` = "Dromas_ardeola", `51` = "Larus_fuscus", `52` = "Rynchops_flavirostris", 
    `53` = "Sterna_fuscata", `54` = "Stercorarius_pomarinus", 
    `55` = "Uria_aalge", `56` = "Apus_caffer", `57` = "Apaloderma_narina", 
    `58` = "Alcedo_semitorquata", `59` = "Caprimulgus_rufigena", 
    `60` = "Sturnus_vulgaris", `61` = "Cinclus_leucocephalus", 
    `62` = "Cinclus_schulzi", `63` = "Poicephalus_robustus", 
    `64` = "Centropus_senegalensis"), edge.label = structure(character(0), .Names = character(0)), 
    order = "preorder", annote = list())

1 个答案:

答案 0 :(得分:1)

要访问S4对象的插槽,您需要使用@,而不是$

使用local$label代替local@label

在这里直接了解S4类:

http://adv-r.had.co.nz/S4.html