grDevices: The R Graphics Devices and Support for Colours and Fonts

> library(grDevices)

バージョン: 3.2.3

関数名 概略
Devices List of Graphical Devices
Hershey Hershey Vector Fonts in R
Japanese Japanese characters in R
Type1Font Type 1 and CID Fonts
X11Fonts X11 Fonts
adjustcolor Adjust Colors in One or More Directions Conveniently.
as.graphicsAnnot Coerce an Object for Graphics Annotation
as.raster Create a Raster Object
axisTicks Compute Pretty Axis Tick Scales
boxplot.stats Box Plot Statistics
check.options Set Options with Consistency Checks
chull Compute Convex Hull of a Set of Points
cm Unit Transformation
col2rgb Color to RGB Conversion
colorRamp Color interpolation
colors Color Names
contourLines Calculate Contour Lines
convertColor Convert between Colour Spaces
densCols Colors for Smooth Density Plots
dev.capabilities Query Capabilities of the Current Graphics Device
dev.capture Capture device output as a raster image
dev.copy Copy Graphics Between Multiple Devices
dev.cur Control Multiple Devices
dev.flush Hold or Flush Output on an On-Screen Graphics Device.
dev.interactive Is the Current Graphics Device Interactive?
dev.size Find Size of Device Surface
dev2bitmap Graphics Device for Bitmap Files via Ghostscript
devAskNewPage Prompt before New Page
embedFonts Embed Fonts in PostScript and PDF
extendrange Extend a Numerical Range by a Small Percentage
getGraphicsEvent Wait for a mouse or keyboard event from a graphics window
grDevices-package The R Graphics Devices and Support for Colours and Fonts
grSoftVersion Report Versions of Graphics Software
gray Gray Level Specification
gray.colors Gray Color Palette
hcl HCL Color Specification
hsv HSV Color Specification
make.rgb Create colour spaces
n2mfrow Compute Default mfrow From Number of Plots
nclass.Sturges Compute the Number of Classes for a Histogram
palette Set or View the Graphics Palette
pdf PDF Graphics Device
pdf.options Auxiliary Function to Set/View Defaults for Arguments of pdf
pictex A PicTeX Graphics Driver
plotmath Mathematical Annotation in R
png BMP, JPEG, PNG and TIFF graphics devices
postscript PostScript Graphics
postscriptFonts PostScript and PDF Font Families
pretty.Date Pretty Breakpoints for Date-Time Classes
ps.options Auxiliary Function to Set/View Defaults for Arguments of postscript
quartz OS X Quartz Device
quartzFonts quartz Fonts
rainbow Color Palettes
recordGraphics Record Graphics Operations
recordPlot Record and Replay Plots
rgb RGB Color Specification
rgb2hsv RGB to HSV Conversion
savePlot Save Cairo X11 Plot to File
svg Cairographics-based SVG, PDF and PostScript Graphics Devices
trans3d 3D to 2D Transformation for Perspective Plots
x11 X Window System Graphics
xfig XFig Graphics Device
xy.coords Extracting Plotting Structures
xyTable Multiplicities of (x,y) Points, e.g., for a Sunflower Plot
xyz.coords Extracting Plotting Structures

Palettes / rainbow / heat.colors / terrain.colors / topo.colors / cm.colors



  • n
  • s, v
  • start
  • end
  • alpha
> rainbow(n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n, alpha = 1)
> heat.colors(n, alpha = 1)
> terrain.colors(n, alpha = 1)
> topo.colors(n, alpha = 1)
> cm.colors(n, alpha = 1)



> colors(distinct = FALSE) %>% {
+   sample(., 1) %>% print()
+   length(.)
+ }
[1] "gray86"
[1] 657

colorRamp / colorRampPalette


  • colors
  • bias
  • space
  • interpolate
  • alpha
  • ...
> colorRampPalette(c("red", "green"))(5)
[1] "#FF0000" "#BF3F00" "#7F7F00" "#3FBF00" "#00FF00"




  • red, blue, green, alpha
  • names
  • maxColorValue
> rgb(red = 0, green = 1, blue = 0)
[1] "#00FF00"