devtools::install_git("https://git.sr.ht/~hrbrmstr/supercaliheatmapwidget")
# or
devtools::install_gitlab("hrbrmstr/supercaliheatmapwidget")
# or
devtools::install_github("hrbrmstr/supercaliheatmapwidget")
library(supercaliheatmapwidget)
Let’s make some data:
set.seed(2019-01-02)
data.frame(
day = seq(as.Date("2018-01-01"), as.Date("2018-12-31"), "1 day"),
val = sample(100, 365, replace=TRUE)
) -> calendar_data
Notice that:
NA
s in thersupercal(calendar_data, datetime_col = day, value_col = val, height="100%")
Notice that:
NA
s decentlyWhat about only showing the first four months?
supercal(
calendar_data,
datetime_col = day, value_col = val,
range = 4,
height="100%"
)
What if we:
supercal(
calendar_data,
datetime_col = day, value_col = val,
cell_size = 40,
range = 4,
height="100%"
) %>%
cal_legend(
color = cal_colors("#deebf7", "#084594"),
breaks = 4,
cell_size = 20,
hjust = "center"
)
Now, say we want to:
supercal(
calendar_data,
datetime_col = day, value_col = val,
label = cal_label("top", "center"),
cell_size = 40,
tooltip_item_name = cal_names("incident"),
range = 4,
height="100%"
) %>%
cal_legend(
color = cal_colors("#deebf7", "#084594"),
breaks = 4,
cell_size = 20,
hjust = "center"
) %>%
label_cells(js_body = "return(value);")
How about:
supercal(
calendar_data,
datetime_col = day, value_col = val,
label = cal_label("top", "center"),
cell_size = 40,
tooltip_item_name = cal_names("incident"),
range = 4,
height="100%"
) %>%
cal_legend(
color = cal_colors("#deebf7", "#084594"),
breaks = 4,
cell_size = 20,
hjust = "center"
) %>%
label_cells(js_body = "return(value);") %>%
cal_style(
graph_label = "font-family: 'Muli Black'; fill: black; font-size: 14pt;",
subdomain_text = "font-family: 'Muli'; fill: white; font-size:10pt"
) %>%
htmlwidgets::prependContent(
htmltools::tags$style("@import url('https://fonts.googleapis.com/css?family=Muli:400,400i,700');")
)
And, perhaps circles are more your thing:
supercal(
calendar_data,
datetime_col = day, value_col = val,
label = cal_label("top", "center"),
cell_size = 40, cell_radius = 40,
tooltip_item_name = cal_names("incident"),
range = 4,
height="100%"
) %>%
cal_legend(
color = cal_colors("#deebf7", "#084594"),
breaks = 4,
cell_size = 20,
hjust = "center"
) %>%
label_cells(js_body = "return(value);") %>%
cal_style(
graph_label = "font-family: 'Muli Black'; fill: black; font-size: 14pt;",
subdomain_text = "font-family: 'Muli'; fill: white; font-size:10pt"
) %>%
htmlwidgets::prependContent(
htmltools::tags$style("@import url('https://fonts.googleapis.com/css?family=Muli:400,400i,700');")
)