How do I change the position of labels in the R treemap? -
i've made treemap using r treemap package 2 levels of hierarchy.
my problem of labels overlap, can't see lower level hierarchy label. in example man page (see below), can't see country label ukraine because continent label (europe) on top of it. know can make labels smaller font, there way move position of labels? example, move continent labels upper left corner of continent boxes can see country names?
require(treemap) data(gni2010) treemap(gni2010, index=c("continent", "iso3"), vsize="population", vcolor="gni", type="value")
this possible recent versions of treemap using align.labels option. there several other new options might well.
in documentation align.list says:
object specifies alignment of labels. either character vector of 2 values specifying horizontal alignment ("left", "center", or "right") , vertical alignment ("top", "center", or "bottom"), or list of such character vectors, 1 each aggregation level.
one thing note order in each of character vectors matters. is, value corresponds x axis location comes first , value y axis location. e.g., c("right", "bottom") valid c("bottom", "right") not.
here original example corrected labels not overlap.
data(gni2014) treemap(gni2014, index=c("continent", "iso3"), vsize="population", vcolor="gni", type="value", align.labels = list(c("left", "top"), c("right", "bottom")) ) 
Comments
Post a Comment