Skip to content

How can I change the height and width of the elements (rectangles) on the heat map? #613

Closed
@SerhEL

Description

@SerhEL

I want to change the width and height of the heatmap elements to make them square. Here is my code:

library(echarts4r)
library(dplyr)

table <- "kn    ln  gr  cn
1   BA  BA  10
1   XB  XB  1
2   FL  XB  5
2   GS  BC  6
3   GG  BC  4
3   BS  BA  0"

df <- read.table(text = table, header = TRUE, sep = "\t")

df_grouped <- df |> 
  arrange(gr, ln) |> 
  mutate(ln = factor(ln, levels = unique(ln)))

df_grouped |> 
  e_charts(kn) |> 
  e_heatmap(ln, cn, name = "value") |> 
  e_x_axis(data = unique(df$kn)) |>
  e_y_axis(data = unique(df_grouped$ln),
           axisLabel = list(rotate = 0, interval = 0, fontSize = 10, color = 'black'),
           scale = TRUE,
           axisTick = list(alignWithLabel = TRUE)
  ) |>
  e_visual_map(cn) |> 
  e_toolbox(
    feature = list(
      dataZoom = list(
        xAxisIndex = 0,
        yAxisIndex = 0
      ),
      restore = list()
    )
  )

9Bhql

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions