Tom-Jenkins / mapmixture

An R package and web app for spatial visualisation of admixture on a projected map
GNU General Public License v3.0
37 stars 7 forks source link

overlapping pies #20

Open cgdmkns opened 4 weeks ago

cgdmkns commented 4 weeks ago

Dear Tom, Thanks for this package; it's convenient to use for great plots. I've successfully created a map with pie charts representing the STRUCTURE results of my data. However, the pie charts are overlapping due to the close proximity of my populations. Is there a way to plot these pie charts separately, with lines or arrows pointing to their exact coordinates using mapmixture? Thanks in advance, Cigdem

Tom-Jenkins commented 3 weeks ago

Hi @cgdmkns,

To incorporate this is not trivial which is why the package does not currently support this. However, I am looking into how best to implement this programmatically in future versions.

It would be ideal to use ggrepel, but this package currently supports only text and label geoms. The pies in mapmixture are currently rendered on the map as annotation custom objects, because this allows users to easily project their maps to a different CRS without distortion of the pie charts.

Nevertheless, you could achieve your goal by (A) programming the pie chart positions manually, or (B) by plotting two maps where one is a zoomed-in map (you could then plot an inset map). If you provide your current code and a subset of your data, I could look into how you could approach option A.

cgdmkns commented 3 weeks ago

Thanks for the quick reply! I understand that adding this feature is complex. I'll try to plot different maps and zoom in on the locations of the populations, as you suggested as option B. By the way, I sent you an email including a subset of my data and code.

Best regards, Cigdem