Highcharter Trelliscope

hc_xy_trelliscope(
  data,
  grouping_variables = NULL,
  map_data = NULL,
  data_cognostics = NULL,
  return_raw_data = F,
  add_id_column = T,
  data_column_name = NULL,
  filter_parameters = NULL,
  id_columns = NULL,
  password = NULL,
  input_cognostics = NULL,
  view_parameters = NULL,
  trelliscope_path = NULL,
  trelliscope_title = NULL,
  sort_columns = NULL,
  sort_level = "desc",
  is_self_contained = T,
  width = 650,
  height = 500,
  rows = 1,
  columns = 2,
  description = "",
  push_to_github = F,
  use_trelliscope2 = F,
  use_jsonp = T,
  markdown_description = "",
  generate_thumbnail = F,
  trelliscope_group = "common",
  require_token = F,
  trelliscope_id = NULL,
  split_sig = NULL,
  order = 1,
  use_auto_cognostics = F,
  disclaimer = F,
  type = "scatter",
  x = NULL,
  y = NULL,
  group = NULL,
  name = NULL,
  target = NULL,
  size = NULL,
  color = NULL,
  from = NULL,
  to = NULL,
  weight = NULL,
  link = NULL,
  image_column = NULL,
  low = NULL,
  high = NULL,
  glue_title = NULL,
  glue_subtitle = NULL,
  glue_credits = NULL,
  glue_caption = NULL,
  data_tooltip = NULL,
  data_tooltip_params = NULL,
  drill = NULL,
  motion = NULL,
  motion_labels = NULL,
  tooltip = NULL,
  x_factor_reverse = F,
  y_factor_reverse = F,
  relevel_y_heatmap = F,
  relevel_x_heatmap = F,
  remove_columns = NULL,
  color_type = "discrete",
  color_palette = NULL,
  map_join_by = NULL,
  use_color_class = F,
  download_map_data = T,
  enable_navigation = TRUE,
  n_color_breaks = 10,
  n_colors = 4,
  color_axis_type = "linear",
  disable_inactive = F,
  disable_opacity = 0,
  facet = NULL,
  category = NULL,
  opacity = 1,
  fits = NULL,
  add_bcp_fits = F,
  include_change_points = F,
  include_bcp_probabilities = F,
  adj = NULL,
  w0 = NULL,
  p0 = 0.2,
  d = 10,
  burnin = 500,
  mcmc = 100,
  override_legend_location = NULL,
  use_table_tooltip = F,
  override_name = NULL,
  prediction_periods = 0,
  sequence_period_type = "day",
  lag_opacity = 1,
  lag_periods = NULL,
  lag_chart_type = "line",
  lag_color_palette = NULL,
  lag_point_size = 1,
  roll_periods = NULL,
  roll_metrics = "mean",
  roll_lag_periods = NULL,
  roll_align = "right",
  roll_weights = NULL,
  roll_chart_type = "line",
  roll_color_palette = NULL,
  fill_by = NA,
  roll_opacity = 1,
  roll_point_size = 0,
  keep_non_lag_variable = F,
  enable_bayes_boot = F,
  bb_size = NULL,
  bb_image = NULL,
  bb_chart_type = "line",
  bb_color_type = "discrete",
  bb_color_palette = NULL,
  bb_point_size = 0,
  bb_draws = 4000,
  bb_resample_draws = 4000,
  bb_opacity = 1,
  use_weights = T,
  use_beast = F,
  beast_opacity = 1,
  beast_type = "line",
  beast_color_type = "discrete",
  beast_color_palette = NULL,
  beast_option = list(period = 23, burnin = 1000, sample = 1000, chainNumber = 10),
  beast_minimum_data_points = 15,
  prophet_opacity = 0.2,
  prophet_color_palette = NULL,
  prophet_growth = "linear",
  prophet_prediction_period = NULL,
  prediction_frequency = "day",
  n.changepoints = 25,
  changepoint.range = 0.8,
  yearly.seasonality = "auto",
  weekly.seasonality = "auto",
  daily.seasonality = "auto",
  holidays = NULL,
  seasonality.mode = "additive",
  seasonality.prior.scale = 10,
  holidays.prior.scale = 10,
  changepoint.prior.scale = 0.05,
  mcmc.samples = 0,
  interval.width = 0.8,
  x_limits = NULL,
  y_limits = NULL,
  plot_dimensions = NULL,
  use_fast = F,
  color_axis = NULL,
  fit_type = "line",
  fit_opacity = 1,
  fit_predictions = NULL,
  override_x_rt = T,
  verbose = T,
  labels = NULL,
  x_rtemis = NULL,
  y_rtemis = NULL,
  rt_model_args = NULL,
  exclude_tooltip = F,
  override_series = NULL,
  override_marker = NULL,
  layout_algorithm = "squarified",
  self_contained = T,
  is_sunburst = F,
  tree_labels = list(list(level = 1, dataLabels = list(enabled = TRUE)), list(level =
    2, dataLabels = list(enabled = T)), list(level = 3, dataLabels = list(enabled = T)),
    list(level = 4, dataLabels = list(enabled = T)), list(level = 5, dataLabels =
    list(enabled = T)), list(level = 6, dataLabels = list(enabled = T)), list(level = 7,
    dataLabels = list(enabled = T))),
  disable_marker = F,
  marker = NULL,
  marker_parameters = list(width = 40, height = 30),
  theme_name = "hcrt",
  theme_custom = NULL,
  override_x_label = NULL,
  override_y_label = NULL,
  facet_column_count = 3,
  facet_height = NULL,
  override_model_groups = F,
  override_x_text = F,
  override_y_text = F,
  override_x_format = NULL,
  override_y_format = NULL,
  group_to_character = T,
  override_tooltip = F,
  use_shadow = F,
  disable_x = F,
  disable_y = F,
  boost = F,
  invert_chart = F,
  disable_legend = F,
  frame_widget = F,
  frame_width = "100%",
  frame_height = NULL,
  frame_element = NULL,
  frame_options = frameOptions(allowfullscreen = T),
  share_tooltip = F,
  annotations = NULL,
  stacking = NULL,
  drilldown_params = NULL,
  point_size = 3,
  border_width = 1,
  show_colors = F,
  direction = 1,
  point_width = 8,
  label_parameters = list(enabled = F, useHTML = T, format = "{point.name}"),
  transformations = NULL,
  export = F,
  use_stock = F,
  use_scrollbar = F,
  use_navigator = F,
  is_polar = F,
  halo_size = 10,
  use_point_select = F,
  use_regression = F,
  data_x_lines = NULL,
  data_y_lines = NULL,
  responsive_layout = T,
  zoom_type = c("xy"),
  isolate_legend_group = T,
  element_id_text = NULL,
  axis_scrollbars = NULL,
  x_min_max = NULL,
  y_min_max = NULL,
  transparent_tooltip = F,
  sort_y = F,
  override_x_categories = NULL,
  legend_font_size = NULL,
  order_method = "sum",
  plot_symbol = NULL,
  hc = NULL,
  chart_in_chart_height = 225,
  chart_in_chart_width = 400,
  use_range_selector = F,
  row_height = NULL,
  remove_data_columns = T,
  conditional_cols = NULL,
  ...
)

Arguments

disable_opacity
theme_name

if not NULL

  • 538

  • chalk

  • darkunica

  • db

  • economist

  • elementary

  • ffx

  • flat

  • flatdark

  • ft

  • ggplot2

  • google

  • gridlight

  • handdrawn

  • merge

  • monokai

  • null

  • sandsignika

  • smpl

  • sparkline

  • superheroes

  • tufte

  • tufte2

Value

Examples


library(dplyr)
library(tidyverse)
library(asbviz)


# palmer_penguins ---------------------------------------------------------

library(palmerpenguins)


tbl_summary <-
  penguins %>%
  group_by(species) %>%
  summarise(
    count = n(),
    distinct_islands = n_distinct(island),
    mean_bill_length = mean(bill_length_mm, na.rm = T),
    mean_bill_depth = mean(bill_depth_mm, na.rm = T),
    mean_body_mass = mean(body_mass_g, na.rm = T),
    .groups = "drop"
  )

tbl_plot <-
  penguins %>%
  select(species, flipper_length_mm, sex, body_mass_g) %>%
  group_by(species) %>%
  nest() %>%
  ungroup()

df <- tbl_summary %>%
  left_join(
    tbl_plot,
    by = "species"
  )


hc_xy_trelliscope(
  data = df,
  data_column_name = "data",
  id_columns = c(
    "species",
    "distinct_islands",
    "mean_bill_length",
    "mean_body_mass",
    "mean_bill_depth"
  ),
  x = "flipper_length_mm",
  y = "body_mass_g",
  group = "sex",
  fits = "lm",
  trelliscope_path = NULL
)


# map ---------------------------------------------------------------------


data("USArrests", package = "datasets")

tbl_usa <-
  mutate(USArrests, state = rownames(USArrests)) %>% as_tibble()
tbl_usa_long <-
  tbl_usa %>%
  asbtools::tbl_pivot_longer()

tbl_summary <- tbl_usa_long %>%
  asbtools::tbl_summarise(
    group_variables = "feature",
    mean_variables = c("value"),
    median_variables = "value",
    sd_variables = "value",
    which_max_variables = "state",
    which_min_variables = "state",
    top_variables = "state",
    calculation_variable = "value"
  )

tbl_usa_trell <-
  tbl_usa_long %>%
  group_by(feature) %>%
  nest() %>%
  ungroup() %>%
  left_join(tbl_summary, by = "feature") %>%
  select(-data, everything())

asbviz::hc_xy_trelliscope(
  data = tbl_usa_trell,
  map_data = "countries/us/us-all",
  y = "value",
  type = "map",
  map_join_by = c("woe-name", "state"),
  theme_name = "better_unica",
  use_color_class = T,
  disable_legend = F,
  states = list(hover = list(color = '#a4edba')),
  color_axis_type = "logarithmic",
  label_parameters = list(enabled = T,
                          format =  '{point.properties.postal-code}'),
  color_palette = "pals::kovesi.rainbow_bgyr_35_85_c72",
  glue_title = "{feature} from USAArrests Data",
  trelliscope_title = "USA Arrests Map Test, All Features",
  color_type = "continuous",
  data_column_name = "data",
  id_columns = names(tbl_usa_trell %>% select(-data))
)