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 name package. require designed use inside other functions; returns false , gives warning (rather error library() default) if package not exist.

and in other question: what difference between require() , library()?


Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -