mayoverse / kinship2

Pedigree creation, plotting, and analytics
GNU General Public License v2.0
13 stars 7 forks source link

Kinship2 plot.pedigree question #4

Open zihhuafang opened 3 years ago

zihhuafang commented 3 years ago

Hi @sinnweja,

Thank you for developing kinship2 package. I found it extremely useful for plotting pedigrees, and it's a time saver!

I plotted my pedigree (see attached file) but would like to modify certain plotting parameters. I am wondering if you could advise me how to tailor plot.pedigree as I did not fully understand autohints function.

Which parameter can be used to align a spouse without children to the same level of the other one of the couple? I ran autohint not sure what to change here.

autohint(ped2, hints, packed=F, align=T)
$order
 [1]  1  2  3  4  5  6  7  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27  1  2
[37]  1  4  2  3  7  4  9  5 11  6  7 14  8 16 17  9 10 11 21 12 13 14 25  1  2  3  4  1  2  3  4

$spouse
     [,1] [,2] [,3]
temp   35   36    0

Which parameter can be used to provide the coordinate of the legend placement? Is it possible other than "location"?

Appreciate your input!! Best wishes, Zih-Hua

Rplot02.pdf

sinnweja commented 2 years ago

Zih-Hua, the function pedigree.legend is limited to the "x" argument of the regular legend function, e.g., "topright", "bottomleft". I understand the frustration, which is why I tried to work up a better legend with the legendPlot() function.

` data(sample.ped) pedAll <- pedigree(sample.ped$id, sample.ped$father, sample.ped$mother, sample.ped$sex, affected=cbind(affected=sample.ped$affected, avail=sample.ped$avail), famid=sample.ped$ped)

ped2 <- pedAll['2'] plot(ped2)

add single-circle legend to top right with default size(radius)

pedigree.legend(ped2, location="topright")

this might be more clean

legendPlot(ped2) `