R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("colorspace-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('colorspace') Attaching package: 'colorspace' The following object(s) are masked from package:grDevices : hcl > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "HSV" > > ### * HSV > > flush(stderr()); flush(stdout()) > > ### Name: HSV > ### Title: Create HSV Colors > ### Aliases: HSV > ### Keywords: color > > ### ** Examples > > # A rainbow of full-intensity hues > hsv = HSV(seq(0, 360, length=13)[-13], 1, 1) > > > > cleanEx(); ..nameEx <- "LAB" > > ### * LAB > > flush(stderr()); flush(stdout()) > > ### Name: LAB > ### Title: Create LAB Colors > ### Aliases: LAB > ### Keywords: color > > ### ** Examples > > ## Show the LAB space > x = RGB(runif(1000), runif(1000), runif(1000)) > plot(as(x,"LAB")) > > > > cleanEx(); ..nameEx <- "LUV" > > ### * LUV > > flush(stderr()); flush(stdout()) > > ### Name: LUV > ### Title: Create LUV Colors > ### Aliases: LUV > ### Keywords: color > > ### ** Examples > > ## Show the LUV space > x = RGB(runif(1000), runif(1000), runif(1000)) > plot(as(x,"LUV")) > > > > cleanEx(); ..nameEx <- "RGB" > > ### * RGB > > flush(stderr()); flush(stdout()) > > ### Name: RGB > ### Title: Create RGB Colors > ### Aliases: RGB > ### Keywords: color > > ### ** Examples > > # Create a random set of colors > rgb = RGB(R = runif(20), G = runif(20), B = runif(20)) > > > > cleanEx(); ..nameEx <- "XYZ" > > ### * XYZ > > flush(stderr()); flush(stdout()) > > ### Name: XYZ > ### Title: Create XYZ Colors > ### Aliases: XYZ > ### Keywords: color > > ### ** Examples > > ## Generate white in XYZ space > white = XYZ(95.047, 100.000, 108.883) > > > > cleanEx(); ..nameEx <- "color-class" > > ### * color-class > > flush(stderr()); flush(stdout()) > > ### Name: color-class > ### Title: Class "color" > ### Aliases: color-class RGB-class XYZ-class HSV-class LAB-class LUV-class > ### polarLAB-class polarLUV-class [,color-method coerce,color,RGB-method > ### coerce,color,XYZ-method coerce,color,LAB-method > ### coerce,color,polarLAB-method coerce,color,HSV-method > ### coerce,color,LUV-method coerce,color,polarLUV-method > ### coords,color-method plot,color-method show,color-method > ### Keywords: classes > > ### ** Examples > > x = RGB(runif(1000),runif(1000),runif(1000)) > plot(as(x, "LUV")) > > > > cleanEx(); ..nameEx <- "coords" > > ### * coords > > flush(stderr()); flush(stdout()) > > ### Name: coords > ### Title: Extract the numerical coordinates of a color > ### Aliases: coords > ### Keywords: color > > ### ** Examples > > x = RGB(1, 0, 0) > coords(as(x, "HSV")) H S V [1,] 360 1 1 > > > > cleanEx(); ..nameEx <- "hcl" > > ### * hcl > > flush(stderr()); flush(stdout()) > > ### Name: hcl > ### Title: Create R Colours from Hue, Chroma and Luminance > ### Aliases: hcl > ### Keywords: color > > ### ** Examples > > barplot(rep(1, 12), col = hcl(seq(0, 360, length = 13)[1:12])) > > > > cleanEx(); ..nameEx <- "hex" > > ### * hex > > flush(stderr()); flush(stdout()) > > ### Name: hex > ### Title: Convert Colors To Hexadecimal Strings > ### Aliases: hex > ### Keywords: color > > ### ** Examples > > hsv = HSV(seq(0,360,length=7)[-7], 1, 1) > barplot(rep(1,6), col=hex(hsv)) > > > > cleanEx(); ..nameEx <- "hex2RGB" > > ### * hex2RGB > > flush(stderr()); flush(stdout()) > > ### Name: hex2RGB > ### Title: Convert Hexadecimal Color Specifications To RGB Objects > ### Aliases: hex2RGB > ### Keywords: color > > ### ** Examples > > rgb = hex2RGB(c("#FF0000","#00FF00", "#0000FF")) > > > > cleanEx(); ..nameEx <- "mixcolor" > > ### * mixcolor > > flush(stderr()); flush(stdout()) > > ### Name: mixcolor > ### Title: Compute the convex combination of two colors > ### Aliases: mixcolor > ### Keywords: color > > ### ** Examples > > mixcolor(0.5, RGB(1,0,0), RGB(0,1,0)) R G B [1,] 0.5 0.5 0 > > > > cleanEx(); ..nameEx <- "polarLAB" > > ### * polarLAB > > flush(stderr()); flush(stdout()) > > ### Name: polarLAB > ### Title: Create polarLAB Colors > ### Aliases: polarLAB > ### Keywords: color > > ### ** Examples > > ## Show the polarLAB space > x = RGB(runif(1000), runif(1000), runif(1000)) > plot(as(x,"polarLAB")) > > > > cleanEx(); ..nameEx <- "polarLUV" > > ### * polarLUV > > flush(stderr()); flush(stdout()) > > ### Name: polarLUV > ### Title: Create polarLUV Colors > ### Aliases: polarLUV > ### Keywords: color > > ### ** Examples > > ## Show the polarLUV space > x = RGB(runif(1000), runif(1000), runif(1000)) > plot(as(x,"polarLUV")) > > > > cleanEx(); ..nameEx <- "readRGB" > > ### * readRGB > > flush(stderr()); flush(stdout()) > > ### Name: readRGB > ### Title: Read RGB Color Descriptions > ### Aliases: readRGB > ### Keywords: color > > ### ** Examples > > ## Not run: > ##D rgb = readRGB("pastel.rgb") > ##D hsv = readRGB("pastel.rgb", "HSV") > ## End(Not run) > > > > cleanEx(); ..nameEx <- "readhex" > > ### * readhex > > flush(stderr()); flush(stdout()) > > ### Name: readhex > ### Title: Read Hexadecimal Color Descriptions > ### Aliases: readhex > ### Keywords: color > > ### ** Examples > > ## Not run: > ##D rgb = readhex("pastel.txt") > ##D hsv = readhex("pastel.txt", "HSV") > ## End(Not run) > > > > cleanEx(); ..nameEx <- "writehex" > > ### * writehex > > flush(stderr()); flush(stdout()) > > ### Name: writehex > ### Title: Write Hexadecimal Color Descriptions > ### Aliases: writehex > ### Keywords: color > > ### ** Examples > > x = RGB(runif(10), runif(10), runif(10)) > writehex(x, "random.txt") [1] "random.txt" > > > > ### *