r - Legend size in ggplot2 worldmap -
i using worldmap function maps.r library. runs in ggplot2.
i make legend bit larger. using
theme(legend.key.size = unit(measure, "units")) my r terminal returns:
could not find function "unit" any clue what's going on here? believe correct syntax in ggplot2 adjust legend size.
thanks much, bfb
the function unit in grid package. need explicitly load , add search path with
library("grid") as followup question in comments, since ggplot2 needs grid, grid loaded when ggplot2 loaded , functions made available ggplot2. however, not added global search path (grid's) functions not found when try call them directly. calling library() (or require()) makes them findable.
the difference between 2 functions described in documentation
library(package),require(package)both load package namepackage.requiredesigned use inside other functions; returnsfalse, gives warning (rather errorlibrary()default) if package not exist.
and in other question: what difference between require() , library()?
Comments
Post a Comment