How To Get the Default Color Codes of ggplot2 in R? Last Updated : 29 Oct, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we are going to see how to get the default color codes of ggplot2 in R Programming Language. Get Hex Color Codes Format of Hex Color Codes: Each Hex color code contains the symbol “#” followed by 6 alphabets or numbers. Numbers are in the hexadecimal numeric system. There are 1,67,77,216 different color possibilities. 00 value range of the code represents the lowest intensity of color on the other hand FF value range of code represents the highest intensity. Meaning of a Hex code: The 1st and 2nd variable in Hex color code represents the intensity of red color.The 3rd and 4th variable represents the intensity of green.The 5th and 6th variable represents the intensity of blue. By combining the intensities of red, green, and blue almost any color can be made: Syntax: hue_pal()(n) Parameters: hue_pal(): it is a function present in "scales" packagen: this indicates number of levels Note: We can adjust the value of "n" to get the color code of different levels R library(scales) hue_pal()(6) Output: [1] "#F8766D" "#B79F00" "#00BA38" "#00BFC4" "#619CFF" "#F564E3"Visualising Hex Color Codes Visualizing Hex code using show_col, we will be using the show_col() function to visualize the color codes in grid format. Syntax: show_col(hue_pal()(n)) Parameters: hue_pal(): it is a function present in "scales" packagen: this indicates number of levels The only extra step we have to do is to pass whatever we did in the previous step into show_col() function as an argument. R library(scales) show_col(hue_pal()(16)) Output: We can also visualize in the reverse direction by using the direction parameter Syntax: show_col(hue_pal(direction=-1)(n)) Parameters: hue_pal(): it is a function present in "scales" packagen: this indicates number of levelsdirection: this param specifies the direction in which order we want our colors Code: R library(scales) show_col(hue_pal(direction=-1)(16)) Output: Comment More infoAdvertise with us Next Article How To Get the Default Color Codes of ggplot2 in R? S sudhanshublaze Follow Improve Article Tags : R Language R-ggplot Similar Reads How To Change facet_wrap() Box Color in ggplot2 in R? In this article, we will discuss how to change facet_wrap() box color in ggplot2 in R Programming language. Facet plots, where one subsets the data based on a categorical variable and makes a series of similar plots with the same scale. Facetting helps us to show the relationship between more than t 3 min read Change Theme Color in ggplot2 Plot in R A theme in ggplot2 is a collection of settings that control the non-data elements of the plot. These settings include things like background colors, grid lines, axis labels, and text sizes. we can use various theme-related functions to customize the appearance of your plots, including changing theme 4 min read How to change Colors in ggplot2 Line Plot in R ? A line graph is a chart that is used to display information in the form of series of data points. It utilizes points and lines to represent change over time. Line graphs are drawn by plotting different points on their X coordinates and Y coordinates, then by joining them together through a line from 2 min read How to change background color in R using ggplot2? In this article, we will discuss how to change the background color of a ggplot2 plot in R Programming Language. To do so first we will create a basic ggplot2 plot. Step 1: Create sample data for the plot. sample_data <- data.frame(x = 1:10, y = 1:10) Step 2: Load the package ggplot2. library("gg 2 min read How to Make ECDF Plot with ggplot2 in R? Empirical Cumulative Distribution Function Plot (ECDF) helps us to visualize one or more distributions. ECDF plot is a great alternative for histograms and it has the ability to show the full range of data without the need for various parameters. In this article, we will discuss how to draw an ECDF 3 min read Like