Allows customisation of the Label elements, including item names, in a calendar heatmap.
calheatmapR(data = pletcher) %>%
chLabel(position = "top", itemName = "items")
argument | details | cal-heatmap equivalent |
---|---|---|
calheatmapR | a calendar heatmap returned by calheatmapR |
|
position | position of the label, with respect to the domain | label.position |
align | alignment of the label, with respect to the domain | label.align |
rotate | rotation for vertical label, default is NULL, but accepts “left” or “right” | label.rotate |
width | applied when label is rotated, defines width of label | label.width |
offset | additional control for label positioning | label.offset |
height | height of the domain label (in pixels) | label.height |
itemName | name of entity on calendar being presented | itemName |
The pletcher
data set is used again, along with the chDomain
function to customise the domain. First a look at a calendar heatmap without any Label customisation:
data(pletcher)
calheatmapR(data = pletcher, height = "100%") %>%
chDomain(domain = "month",
subDomain = "day",
start = "2012-11-01",
range = 5)
Now to customise the label, and itemNames (used in tooltip when hovering over a subDomain).
calheatmapR(data = pletcher, height = "100%") %>%
chDomain(domain = "month",
subDomain = "day",
start = "2012-11-01",
range = 5) %>%
chLabel(position = "right",
rotate = "right",
align = "left",
width = 20,
itemName = "% horses beaten")
Combining the code found in the example of chLegend
we can achieve a smart plot
calheatmapR(data = pletcher, height = "100%") %>%
chDomain(domain = "month",
subDomain = "day",
start = "2012-11-01",
range = 5) %>%
chLegend(legend = seq(10, 90, 10),
colours = list(min = "#D8D8D8",
max = "#D9220F",
empty = "#424242"),
cellSize = 15,
cellPadding = 5) %>%
chLabel(position = "right",
rotate = "right",
align = "left",
width = 20,
itemName = "% horses beaten")