You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to create some line charts with grouping and coloring by different variables.
Right now, the color is defined by the group or series. Each series of lines are going to have different color. For example, in the following "citytemp" example, all the Tokyo dots are having one color, while all the London are having another color.
However, I want to color the lines by another column of data, not the series definition. For example, I color the lines by the "SpringSummer" column created below, (we can change the shape of each series to identify the unique series),
Is there any quick examples I can follow? Thank you
library(highcharter)
data(citytemp)
citytemp$SpringSummer = rep( F,nrow(citytemp) )
citytemp$SpringSummer[1:6] = T
hc <- highchart() %>%
hc_xAxis(categories = citytemp$month) %>%
hc_add_series(name = "Tokyo", data = citytemp$tokyo) %>%
hc_add_series(name = "London", data = citytemp$london) %>%
hc_add_series(name = "Other city",
data = (citytemp$tokyo + citytemp$london)/2)
hc
The text was updated successfully, but these errors were encountered:
Yes. It is more like in ggplot2, you have "group" variable, and "color" variable.
I am guessing in the highcharter, we need to create individual data series for each of the unique combination of the "group" x "color".
Am I understanding this correctly?
Hi,
I am trying to create some line charts with grouping and coloring by different variables.
Right now, the color is defined by the group or series. Each series of lines are going to have different color. For example, in the following "citytemp" example, all the Tokyo dots are having one color, while all the London are having another color.
However, I want to color the lines by another column of data, not the series definition. For example, I color the lines by the "SpringSummer" column created below, (we can change the shape of each series to identify the unique series),
Is there any quick examples I can follow? Thank you
library(highcharter)
data(citytemp)
citytemp$SpringSummer = rep( F,nrow(citytemp) )
citytemp$SpringSummer[1:6] = T
hc <- highchart() %>%
hc_xAxis(categories = citytemp$month) %>%
hc_add_series(name = "Tokyo", data = citytemp$tokyo) %>%
hc_add_series(name = "London", data = citytemp$london) %>%
hc_add_series(name = "Other city",
data = (citytemp$tokyo + citytemp$london)/2)
hc
The text was updated successfully, but these errors were encountered: