Learn R Programming

portfolio (version 0.4-3)

map.market: Create a Map of the Market

Description

Utility function for creating a "map of the market" visualization. Creates a treemap where rectangular regions of different size, color, and groupings visualize the stocks in a portfolio.

Usage

map.market(id, area, group, color,
           scale = NULL,
           lab   = c(TRUE, FALSE),
           main  = "Map of the Market",
           print = TRUE)

Arguments

id
A vector storing the labels to be used for each stock.
area
A vector storing the values to be used to calculate the areas of rectangles.
group
A vector specifying the group (i.e. country, sector, etc.) to which each stock belongs.
color
A vector storing the values to be used to calculate the color of rectangles.
scale
An object of class numeric indicating the scale to be used in determining colors.
lab
A logical vector of length 2 specifying whether group and stock labels should be drawn. If the two values are the same, the second may be omitted.
main
A title for the plot.
print
An object of class logical indicating whether the map should be drawn.

Examples

Run this code
data(dow.jan.2005)
map.market(id    = dow.jan.2005$symbol,
           area  = dow.jan.2005$price,
           group = dow.jan.2005$sector,
           color = 100 * dow.jan.2005$month.ret)

Run the code above in your browser using DataLab