Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set size of pie diameter #25

Open
JDuffyEx opened this issue Dec 2, 2024 · 2 comments
Open

Set size of pie diameter #25

JDuffyEx opened this issue Dec 2, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@JDuffyEx
Copy link

JDuffyEx commented Dec 2, 2024

Hello,

Thanks for the tool, is there a way to scale the radius of the pies so they are proportional to a value for each location e.g. rpkm?

Cheers!

@Tom-Jenkins
Copy link
Owner

Tom-Jenkins commented Dec 3, 2024

Hi @JDuffyEx,

I received your issue via email but there is no text in your post since your edit. Please can you re-post your issue, otherwise I will close this.

Thanks,
Tom

Update:
I can see your post again. I will try and implement this functionality but it may take me some time.

@Tom-Jenkins Tom-Jenkins self-assigned this Dec 4, 2024
@Tom-Jenkins Tom-Jenkins added the enhancement New feature or request label Dec 11, 2024
@Tom-Jenkins
Copy link
Owner

Hi @JDuffyEx,

I think I have implemented the feature you described. The pie_size argument now accepts a single value or a vector of values the same length as the number of sites. This allows users to plot pies of different sizes for different sites.

Example:

library(mapmixture)

# Admixture Format 1
file <- system.file("extdata", "admixture1.csv", package = "mapmixture")
admixture1 <- read.csv(file)

# Coordinates Format
file <- system.file("extdata", "coordinates.csv", package = "mapmixture")
coordinates <- read.csv(file)

# Plot using a single value
mapmixture(admixture1, coordinates, pie_size = 1)
mapmixture(admixture1, coordinates, pie_size = 1, crs = 3035)

# Plot using a vector of values
pie_radius <- c(1,2,1,3,1,1,1,1,1,1)
mapmixture(admixture1, coordinates, pie_size = pie_radius)
mapmixture(admixture1, coordinates, pie_size = pie_radius, crs = 3035)

image

You will also get an informative warning if you input an incorrect number of pie radius values:

> mapmixture(admixture1, coordinates, pie_size = c(1,2,3), crs = 3035)
Error in mapmixture(admixture1, coordinates, pie_size = c(1, 2, 3), crs = 3035) : 
  Invalid input: pie_size vector must be of length 1 or the same length as the number of sites

Please let me know if this is OK. It will be part of the next release of mapmixture to CRAN. For now, to use this feature download the latest development version from GitHub:

# install.packages("devtools")
devtools::install_github("Tom-Jenkins/mapmixture")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants