Learn R Programming

treemap (version 1.0-4)

tmLocate: Returns info about clicked rectangle

Description

This function returns information about the object on which user has clicked.

Usage

tmLocate(npcClick, tmSave)

Arguments

npcClick
mouse click in npc coordinates, which can be generated by tmClick
tmSave
treemap information: value returned by tmPlot

Examples

Run this code
data(sbsData)
tmSave <- tmPlot(sbsData,
				 index=c("section", "subsection"),
				 vSize=c("employees09", "value added09", "turnover09", "salaries09"),
				 vColor=c("employees08", "value added08", "turnover08", "salaries08"),
				 type="comp")
	# capture mouseclick
	npcClick <- tmClick()

	# locate clicked object
	print(tmLocate(npcClick, tmSave))

Run the code above in your browser using DataLab