Search code examples
rr-highcharter

How to set zlim values in R-highcharter plots


How does one control the z-axis for highcharter matrix plots in R?

library(highcharter)
data(volcano)
hchart(volcano/2, zlim=c(0,200))

Solution

  • If you mean the color-axis, then this is a way to control it:

    library(highcharter)
    data(volcano)
    hc <- hchart(volcano/2) %>%
      hc_colorAxis(min = 0, max = 200)
    hc
    

    Basically you create a highcharter object using the function hchart then using the function hc_colorAxis you can modify the created object and get a new object in return.

    enter image description here

    For other nice examples of highcharter functions please see: http://jkunst.com/highcharter/highcharts-api.html

    And for info about the forward-pipe operator %>% you can see the documentation of package magrittr: https://github.com/tidyverse/magrittr. But magrittr is not needed here if you are using highcharter.