# a rather boring tag cloud
data( gambia )
terms <- gambia$Term
tagcloud( terms )
# tag cloud with weights relative to P value
# colors relative to odds ratio, from light
# grey to black
weights <- -log( gambia$Pvalue )
colors <- smoothPalette( gambia$OddsRatio, max=4 )
tagcloud( terms, weights, col= colors, algorithm= "oval" )
# tag cloud filling the whole plot
tagcloud( terms, weights, col= colors, algorithm= "fill" )
# just a list of only the first ten terms
tagcloud( terms, weights, sel= 1:10,
col= colors, algorithm= "list", order= "width" )
# oval, with line breaks in terms
terms <- strmultline( gambia$Term )
tagcloud( terms, weights, col= colors, algorithm= "oval" )
if (FALSE) {
# shows available font families, scaled according to
# the total disk space occupied by the fonts
require( extrafont )
ft <- fonttable()
fi <- file.info( fonttable()$fontfile )
families <- unique( ft$FamilyName )
sizes <- sapply( families,function( x ) sum( fi[ ft$FamilyName == x, "size" ] ) )
tagcloud( families, sizes, family= families )
}
Run the code above in your browser using DataLab