R Tree-maps - make background label transparent
I am trying to create a treemap using R package treemap
. Here is the code (this is a sample from the package)
library(treemap)
data(GNI2010)
treemap(GNI2010,
index=c("continent", "iso3"),
vSize="population",
vColor="GNI",
type="value")
The problem I ran into was the color of the labels. When I only have one index, then the output is ok:
library(treemap)
data(GNI2010)
treemap(GNI2010,
index=c("iso3"), #single index
vSize="population",
vColor="GNI",
type="value")
But when I have multiple indices, the label changes color. I just want all labels to be transparent. Is it possible?
+3
source to share
2 answers
As I wrote this, I found the solution in the documentation: you just need to add the option bg.lables = 0
. Its range is from 0 to 255, the default is 220.
library(treemap)
data(GNI2010)
treemap(GNI2010,
index=c("continent", "iso3"),
vSize="population",
vColor="GNI",
type="value",
bg.labels = 0)
There are other options in the package to let you play with colors. But at least the label can be transparent.
+1
source to share