Learn R Programming

loon (version 1.4.1)

get_display_color: Return the Displayed Color

Description

Always reflect the current displayed color.

Usage

get_display_color(color, selected)

Value

The color shown on the plot

Arguments

color

the loon widget color

selected

the selected states

Details

In loon, each element (i.e. point, bin, line) has a "temporary" color and a "permanent" color. If one element is selected, the color is switched to the "temporary" color to highlight it. If the selection state is eliminated, the "permanent" color of this element will be displayed. Our function always gives the "temporary" displayed color.

Examples

Run this code
if(interactive()) {
  p <- l_plot(1:10)
  p['selected'][c(1,3,5)] <- TRUE

  displayedColor <- get_display_color(p['color'], p['selected'])
  plot(1:10, bg = as_hex6color(displayedColor), pch = 21)
}

Run the code above in your browser using DataLab