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

Customise labels (for example add aggregate information) #15

Open
mpikoula opened this issue Feb 25, 2015 · 2 comments
Open

Customise labels (for example add aggregate information) #15

mpikoula opened this issue Feb 25, 2015 · 2 comments

Comments

@mpikoula
Copy link

First of all thanks for an amazing package, I'm still exploring it and it's really great and comprehensively written.

I am however an R beginner, and have been trying to add a modification for enabling me to print out aggregate information (so sums, or percentages) below the labels. Do you have a suggestion of a starting point for me perhaps?

Cheers,

Maria

@mtennekes
Copy link
Owner

There is no direct way to do this. A trick that may work is: calculate the aggregates, and add them to you factor levels. For example:

library(treemap)
data(business)

totals <- round(tapply(business$turnover, INDEX = list(business$NACE1), FUN = sum, na.rm=TRUE))
levels(business$NACE1) <- paste(levels(business$NACE1), totals, sep=": ")

treemap(business, index = c("NACE1", "NACE2"), vSize="turnover")

@mpikoula
Copy link
Author

Thanks a lot, this sort of does what I want, although would be nice to see a more flexible feature in the future (might get up to it if I find time)

Cheers,

Maria

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

No branches or pull requests

2 participants