Skip to content
Related Articles

Related Articles

Set or View the Graphics Palette in R Programming – palette() Function
  • Last Updated : 30 Jun, 2020

palette() function in R Language is used to set or view The Graphics Palette.

Syntax: palette(value)

Parameters:
value: an optional character vector.

Example 1:




# R program to illustrate
# palette function
  
# Calling the palette() function
# to obtain the current palette
palette()

Output:



[1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta" "yellow" 
[8] "gray"  

Example 2:




# R program to illustrate
# palette function
  
# Calling the palette() function
# to set 2 extra Graphics Palette
palette(c(palette(), "purple", "brown"))
  
# Viewing the final added Graphics Palette
palette()

Output:

[1] "black"   "red"     "green3"  "blue"    "cyan"    "magenta" "yellow" 
[8] "gray"    "purple"  "brown"  

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

My Personal Notes arrow_drop_up
Recommended Articles
Page :