emmanuelparadis / pegas

Population and Evolutionary Genetics Analysis System
GNU General Public License v2.0
27 stars 10 forks source link

Color the pies of haplonet #73

Closed QianGuoPKU closed 2 years ago

QianGuoPKU commented 2 years ago

Hi Emmanuel,

I want to partition the pie according to samples, and color each slice according to the attributes of the samples. For example, a pie contains five samples from two collection locations.

I learned that, for pie partition, I need to set the 'pie' parameter in the plot function; for slice coloring, I need to set the 'bg' parameter. However, I didn't get the correct colors for each slice of the pie, even though it is correctly partitioned (Fig.1, the incorrect color; Fig. 2, the expected color). So, what is the painting order for the pies and their slices? Does the color set in 'bg' need to be sorted according to the painting order of slices? Fig.1 with incorrect colors:

image

Fig.2 with correct colors:

image

The solution I found was to reset the names of the DNAbin object using the sample attributes. But in this approach, both the pie partition and slice color will be set with the attributes (Fig.2), which is a little different from my expectation.

Do you know the solution to my problem? And could you please provide some demo scripts for my case?

PS: I used pegas package V1.1 in R 4.0.

Thanks, Qian

emmanuelparadis commented 2 years ago

Hi Qian, Several bugs have been fixed for this function. I suggest you install the GH version (1.1-2, dated today). Hopefully this should solve your problem! If not, please get back to us here. Cheers, Emmanuel

QianGuoPKU commented 2 years ago

Hi Emmanuel,

Thanks for your reply! A stupid question (maybe) is how can I get the GH version (1.1-2)? Actually, I found similar issues before I post this issue, but I don't know what does 'GH' mean. Nothing is in 'Release'.

Could you please provide the link of GH version (1.1-2)?

Thanks, Qian

emmanuelparadis commented 2 years ago

GH is GitHub. The package remotes (or the "older" devtools) has a function to install an R package from GH; that's what most users do when they need a more recent version than the one on CRAN. You may try this and get back to us here if this doesn't work. Cheers, Emmanuel

QianGuoPKU commented 2 years ago

Hi Emmanuel,

Thanks for your patient explanation. I installed the GH version (1.1-2) and it worked! I will close this issue :D

Best, Qian