{"id":8203,"date":"2018-11-18T15:47:49","date_gmt":"2018-11-18T13:47:49","guid":{"rendered":"https:\/\/www.datanovia.com\/en\/?p=8203"},"modified":"2020-05-06T06:54:32","modified_gmt":"2020-05-06T05:54:32","slug":"ggplot-colors-best-tricks-you-will-love","status":"publish","type":"post","link":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/","title":{"rendered":"GGPlot Colors Best Tricks You Will Love"},"content":{"rendered":"<div id=\"rdoc\">\n<p>This article presents multiple great solutions you should know for changing <strong>ggplot colors<\/strong>.<\/p>\n<p>When creating graphs with the <em>ggplot2<\/em> R package, colors can be specified either by name (e.g.: \u201cred\u201d) or by hexadecimal code (e.g. : \u201c#FF1234\u201d).<\/p>\n<p>It is also possible to use pre-made color palettes available in different R packages, such as: <em>viridis<\/em>, <em>RColorBrewer<\/em> and <em>ggsci<\/em> packages.<\/p>\n<p>In this tutorial, you\u2019ll learn how to:<\/p>\n<ul>\n<li><strong>Change ggplot colors by assigning a single color<\/strong> value to the geometry functions (<code>geom_point<\/code>, <code>geom_bar<\/code>, <code>geom_line<\/code>, etc). You can use R color names or hex color codes.<\/li>\n<li><strong>Set a ggplot color by groups<\/strong> (i.e.\u00a0by a factor variable). This is done by mapping a grouping variable to the <code>color<\/code> or to the <code>fill<\/code> arguments. In this case, we\u2019ll show how to change manually the default ggplot2 colors by using the functions <code>scale_color_manual()<\/code> and <code>scale_fill_manual()<\/code>. These functions makes it possible to set a custom color palette for each group level.<\/li>\n<li><strong>Use a list of colors that are color-blind friendly<\/strong>. R packages such as <code>viridis<\/code> and <code>RColorBrewer<\/code> provide different color scales that are robust to color-blindness.<\/li>\n<li><strong>Use predefined ggplot color palettes<\/strong>.<\/li>\n<li><strong>Change a ggplot gradient color<\/strong> (also known as continuous color). To create a gradient color in ggplot2, a continuous variable is mapped to the options <code>color<\/code> or <code>fill<\/code>. There are three different types of function to modify the default ggplot2 gradient color, including <code>scale_color_gradient()<\/code>,<code>scale_color_gradient2()<\/code>, <code>scale_color_gradientn()<\/code>. The same scale functions exist for the <code>fill<\/code> arguments: <code>scale_fill_gradient()<\/code>, <code>scale_fill_gradient2()<\/code>, <code>scale_fill_gradientn()<\/code>. We\u2019ll describe step by step how to use them.<\/li>\n<\/ul>\n<p>Contents:<\/p>\n<div id=\"TOC\">\n<ul>\n<li><a href=\"#key-ggplot2-r-functions\">Key ggplot2 R functions<\/a><\/li>\n<li><a href=\"#prerequisites\">Prerequisites<\/a><\/li>\n<li><a href=\"#specify-a-single-color\">Specify a single color<\/a><\/li>\n<li><a href=\"#change-colors-by-groups-ggplot-default-colors\">Change colors by groups: ggplot default colors<\/a><\/li>\n<li><a href=\"#set-custom-color-palettes\">Set custom color palettes<\/a><\/li>\n<li><a href=\"#use-a-colorblind-friendly-palette\">Use a colorblind-friendly palette<\/a><\/li>\n<li><a href=\"#predefined-ggplot-color-palettes\">Predefined ggplot color palettes<\/a>\n<ul>\n<li><a href=\"#viridis-color-palettes\">Viridis color palettes<\/a><\/li>\n<li><a href=\"#rcolorbrewer-palettes\">RColorBrewer palettes<\/a><\/li>\n<li><a href=\"#grey-color-palettes\">Grey color palettes<\/a><\/li>\n<li><a href=\"#scientific-journal-color-palettes\">Scientific journal color palettes<\/a><\/li>\n<li><a href=\"#wes-anderson-color-palettes\">Wes Anderson color palettes<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#gradient-or-continuous-colors\">Gradient or continuous colors<\/a>\n<ul>\n<li><a href=\"#default-ggplot-gradient-colors\">Default ggplot gradient colors<\/a><\/li>\n<li><a href=\"#key-functions-to-change-default-gradient-colors\">Key functions to change default gradient colors<\/a><\/li>\n<li><a href=\"#set-gradient-between-two-colors\">Set gradient between two colors<\/a><\/li>\n<li><a href=\"#set-gradient-between-n-colors\">Set gradient between n colors<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n<\/div>\n<div id=\"key-ggplot2-r-functions\" class=\"section level2\">\n<h2>Key ggplot2 R functions<\/h2>\n<p>This section presents the key ggplot2 R function for changing a plot color.<\/p>\n<p>Set ggplot color manually:<\/p>\n<ul>\n<li><code>scale_fill_manual()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_color_manual()<\/code> or <code>scale_colour_manual()<\/code> for lines and points<\/li>\n<\/ul>\n<p>Use colorbrewer palettes:<\/p>\n<ul>\n<li><code>scale_fill_brewer()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_color_brewer()<\/code> or <code>scale_colour_brewer()<\/code> for lines and points<\/li>\n<\/ul>\n<p>Use grey color scales:<\/p>\n<ul>\n<li><code>scale_fill_grey()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_colour_grey()<\/code> or <code>scale_colour_brewer()<\/code> for points, lines, etc<\/li>\n<\/ul>\n<p>Change the default ggplot gradient color:<\/p>\n<ul>\n<li><code>scale_color_gradient()<\/code>, <code>scale_fill_gradient()<\/code> for sequential gradients between two colors<\/li>\n<li><code>scale_color_gradient2()<\/code>, <code>scale_fill_gradient2()<\/code> for diverging gradients<\/li>\n<li><code>scale_color_gradientn()<\/code>, <code>scale_fill_gradientn()<\/code> for gradient between n colors<\/li>\n<\/ul>\n<\/div>\n<div id=\"prerequisites\" class=\"section level2\">\n<h2>Prerequisites<\/h2>\n<ol style=\"list-style-type: decimal;\">\n<li>Load ggplot2 package and set the default theme:<\/li>\n<\/ol>\n<pre class=\"r\"><code>library(ggplot2)\r\ntheme_set(\r\n  theme_minimal() +\r\n    theme(legend.position = \"right\")\r\n  )<\/code><\/pre>\n<ol style=\"list-style-type: decimal;\" start=\"2\">\n<li><strong>Initialize ggplots<\/strong> using the <code>iris<\/code> data set. Create a box plot (bp) and a scatter plot (sp) that we\u2019ll customize in the next section:<\/li>\n<\/ol>\n<pre class=\"r\"><code># Box plot\r\nbp &lt;- ggplot(iris, aes(Species, Sepal.Length))\r\n\r\n# Scatter plot\r\nsp &lt;- ggplot(iris, aes(Sepal.Length, Sepal.Width))<\/code><\/pre>\n<\/div>\n<div id=\"specify-a-single-color\" class=\"section level2\">\n<h2>Specify a single color<\/h2>\n<p>Colors in R can be specified either by name (e.g.: \u201cred\u201d) or by hexadecimal color codes, such as \u201c#FF1234\u201d. You can find many examples of color names and codes at:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.datanovia.com\/en\/blog\/awesome-list-of-657-r-color-names\/\">Awesome List Of 657 R Color Names<\/a><\/li>\n<li><a href=\"https:\/\/www.datanovia.com\/en\/blog\/awesome-list-of-hexadecimal-colors-you-should-have\/\">Awesome List of Hexadecimal Colors You Should Have<\/a><\/li>\n<\/ul>\n<p>The following R script changes the fill color (in box plots) and points color (in scatter plots).<\/p>\n<ul>\n<li>Using hexadecimal color codes:<\/li>\n<\/ul>\n<pre class=\"r\"><code># Box plot\r\nbp + geom_boxplot(fill = \"#FFDB6D\", color = \"#C4961A\")\r\n\r\n# Scatter plot\r\nsp + geom_point(color = \"#00AFBB\") <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-color-names-1.png\" width=\"288\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-color-names-2.png\" width=\"288\" \/><\/p>\n<ul>\n<li>Using color names<\/li>\n<\/ul>\n<pre class=\"r\"><code># Box plot\r\nbp + geom_boxplot(fill = \"lightgray\", color = \"black\")\r\n\r\n# Scatter plot\r\nsp + geom_point(color = \"steelblue\") <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-hexadecimal-colors-1.png\" width=\"288\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-hexadecimal-colors-2.png\" width=\"288\" \/><\/p>\n<\/div>\n<div id=\"change-colors-by-groups-ggplot-default-colors\" class=\"section level2\">\n<h2>Change colors by groups: ggplot default colors<\/h2>\n<p>You can set colors according to the levels of a grouping variable by:<\/p>\n<ul>\n<li>Mapping the argument <code>color<\/code> to the variable of interest. This will be applied to points, lines and texts<\/li>\n<li>Mapping the argument <code>fill<\/code> to the variable of interest. This will change the fill color of areas, such as in box plot, bar plot, histogram, density plots, etc.<\/li>\n<\/ul>\n<p>In the following example, we\u2019ll map the options <code>color<\/code> and <code>fill<\/code> to the grouping variable <code>Species<\/code>, for scatter plot and box plot, respectively.<\/p>\n<p>Changes colors by groups using the levels of <code>Species<\/code> variable:<\/p>\n<pre class=\"r\"><code># Box plot\r\nbp &lt;- bp + geom_boxplot(aes(fill = Species)) +\r\n  theme(legend.position = \"top\")\r\nbp\r\n\r\n# Scatter plot\r\nsp &lt;- sp + geom_point(aes(color = Species)) +\r\n  theme(legend.position = \"top\")\r\nsp<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-default-colors-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-default-colors-2.png\" width=\"336\" \/><\/p>\n<\/div>\n<div id=\"set-custom-color-palettes\" class=\"section level2\">\n<h2>Set custom color palettes<\/h2>\n<p>It\u2019s possible to set manually the color palettes by using the functions:<\/p>\n<ul>\n<li><code>scale_fill_manual()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_color_manual()<\/code> or <code>scale_colour_manual()<\/code> for lines and points<\/li>\n<\/ul>\n<pre class=\"r\"><code># Box plot\r\nbp + scale_fill_manual(values = c(\"#00AFBB\", \"#E7B800\", \"#FC4E07\"))\r\n\r\n# Scatter plot\r\nsp + scale_color_manual(values = c(\"#00AFBB\", \"#E7B800\", \"#FC4E07\"))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-custom-color-fill-color-manual-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-custom-color-fill-color-manual-2.png\" width=\"336\" \/><\/p>\n<p>You might also find interesting, the following list of colors:<\/p>\n<pre class=\"r\"><code>custom.col &lt;- c(\"#FFDB6D\", \"#C4961A\", \"#F4EDCA\", \r\n                \"#D16103\", \"#C3D7A4\", \"#52854C\", \"#4E84C4\", \"#293352\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-custom-color-palettes-1.png\" width=\"480\" \/><\/p>\n<\/div>\n<div id=\"use-a-colorblind-friendly-palette\" class=\"section level2\">\n<h2>Use a colorblind-friendly palette<\/h2>\n<p>When selecting a set of colors, it\u2019s recommended to make sure that you choose color palettes that are robust to colorblindness. In the next sections, we\u2019ll show you to check that your production figures are colorblind-friendly.<\/p>\n<p>Here, we present two color-blind-friendly palettes, one with gray, and one with black (palettes source: <a class=\"uri\" href=\"http:\/\/jfly.iam.u-tokyo.ac.jp\/color\/\">http:\/\/jfly.iam.u-tokyo.ac.jp\/color\/<\/a>).<\/p>\n<pre class=\"r\"><code># The palette with grey:\r\ncbp1 &lt;- c(\"#999999\", \"#E69F00\", \"#56B4E9\", \"#009E73\",\r\n          \"#F0E442\", \"#0072B2\", \"#D55E00\", \"#CC79A7\")\r\n\r\n# The palette with black:\r\ncbp2 &lt;- c(\"#000000\", \"#E69F00\", \"#56B4E9\", \"#009E73\",\r\n          \"#F0E442\", \"#0072B2\", \"#D55E00\", \"#CC79A7\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-colorblind-freindly-color-palette-1.png\" width=\"288\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-colorblind-freindly-color-palette-2.png\" width=\"288\" \/><\/p>\n<p>You can use these palettes as follow:<\/p>\n<pre class=\"r\"><code># To use for fills, add\r\nbp + scale_fill_manual(values = cbp1)\r\n\r\n# To use for line and point colors, add\r\nsp + scale_colour_manual(values=cbp1)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-colorblind-freindly-color-palette2-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-colorblind-freindly-color-palette2-2.png\" width=\"336\" \/><\/p>\n<\/div>\n<div id=\"predefined-ggplot-color-palettes\" class=\"section level2\">\n<h2>Predefined ggplot color palettes<\/h2>\n<p>You can modify the default ggplot colors by using predefined color palettes available in different R packages. The most commonly used color scales, include:<\/p>\n<ul>\n<li>Viridis color scales [<code>viridis<\/code> package].<\/li>\n<li>Colorbrewer palettes [<code>RColorBrewer<\/code> package]<\/li>\n<li>Grey color palettes [<code>ggplot2<\/code> package]<\/li>\n<li>Scientific journal color palettes [<code>ggsci<\/code> package]<\/li>\n<li>Wes Anderson color palettes [<code>wesanderson<\/code> package]<\/li>\n<\/ul>\n<p>Learn more at: <a href=\"https:\/\/www.datanovia.com\/en\/blog\/top-r-color-palettes-to-know-for-great-data-visualization\/\">Top R Color Palettes to Know for Great Data Visualization<\/a><\/p>\n<div id=\"viridis-color-palettes\" class=\"section level3\">\n<h3>Viridis color palettes<\/h3>\n<p>The <code>viridis<\/code> R package provides color palettes to make beautiful plots that are: printer-friendly, perceptually uniform and easy to read by those with colorblindness. Key functions <code>scale_color_viridis()<\/code> and <code>scale_fill_viridis()<\/code><\/p>\n<pre class=\"r\"><code>library(viridis)\r\n# Gradient color\r\nggplot(iris, aes(Sepal.Length, Sepal.Width))+\r\n  geom_point(aes(color = Sepal.Length)) +\r\n  scale_color_viridis(option = \"D\")\r\n\r\n# Discrete color. use the argument discrete = TRUE\r\nggplot(iris, aes(Sepal.Length, Sepal.Width))+\r\n  geom_point(aes(color = Species)) +\r\n  geom_smooth(aes(color = Species, fill = Species), method = \"lm\") + \r\n  scale_color_viridis(discrete = TRUE, option = \"D\")+\r\n  scale_fill_viridis(discrete = TRUE) <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggplot2-viridis-discrete-color-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggplot2-viridis-discrete-color-2.png\" width=\"336\" \/><\/p>\n<\/div>\n<div id=\"rcolorbrewer-palettes\" class=\"section level3\">\n<h3>RColorBrewer palettes<\/h3>\n<p>The RColorBrewer package creates a nice looking color palettes. Read more at: <a href=\"https:\/\/www.datanovia.com\/en\/blog\/the-a-z-of-rcolorbrewer-palette\/\">The A \u2013 Z Of Rcolorbrewer Palette<\/a><\/p>\n<p>Two color scale functions are available in ggplot2 for using the colorbrewer palettes:<\/p>\n<ul>\n<li><code>scale_fill_brewer()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_color_brewer()<\/code> for lines and points<\/li>\n<\/ul>\n<p>For example:<\/p>\n<pre class=\"r\"><code># Box plot\r\nbp + scale_fill_brewer(palette = \"Dark2\")\r\n\r\n# Scatter plot\r\nsp + scale_color_brewer(palette = \"Dark2\")<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-group-color-rcolorbrewer-1.png\" width=\"316.8\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-group-color-rcolorbrewer-2.png\" width=\"316.8\" \/><\/p>\n<p>To display colorblind-friendly brewer palettes, use this R code:<\/p>\n<pre class=\"r\"><code>library(RColorBrewer)\r\ndisplay.brewer.all(colorblindFriendly = TRUE)<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-rcolorbrewer-palettes-colorblind-friendly-1.png\" width=\"288\" \/><\/p>\n<\/div>\n<div id=\"grey-color-palettes\" class=\"section level3\">\n<h3>Grey color palettes<\/h3>\n<p>Key functions available in ggplot2:<\/p>\n<ul>\n<li><code>scale_fill_grey()<\/code> for box plot, bar plot, violin plot, dot plot, etc<\/li>\n<li><code>scale_colour_grey()<\/code> for points, lines, etc<\/li>\n<\/ul>\n<pre class=\"r\"><code># Box plot\r\nbp + scale_fill_grey(start = 0.8, end = 0.2) \r\n\r\n# Scatter plot\r\nsp + scale_color_grey(start = 0.8, end = 0.2) <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-scale-color-grey-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-scale-color-grey-2.png\" width=\"336\" \/><\/p>\n<\/div>\n<div id=\"scientific-journal-color-palettes\" class=\"section level3\">\n<h3>Scientific journal color palettes<\/h3>\n<p>The R package <code>ggsci<\/code> contains a collection of high-quality color palettes inspired by colors used in scientific journals, data visualization libraries, and more.<\/p>\n<p>The color palettes are provided as ggplot2 scale functions:<\/p>\n<ul>\n<li><code>scale_color_npg()<\/code> and <code>scale_fill_npg()<\/code>: Nature Publishing Group color palettes<\/li>\n<li><code>scale_color_aaas()<\/code> and <code>scale_fill_aaas()<\/code>: American Association for the Advancement of Science color palettes<\/li>\n<li><code>scale_color_lancet()<\/code> and <code>scale_fill_lancet()<\/code>: Lancet journal color palettes<\/li>\n<li><code>scale_color_jco()<\/code> and <code>scale_fill_jco()<\/code>: Journal of Clinical Oncology color palettes<\/li>\n<li><code>scale_color_tron()<\/code> and <code>scale_fill_tron()<\/code>: This palette is inspired by the colors used in Tron Legacy. It is suitable for displaying data when using a dark theme.<\/li>\n<\/ul>\n<p>You can find more examples in the <a href=\"https:\/\/cran.r-project.org\/web\/packages\/ggsci\/vignettes\/ggsci.html\">ggsci package vignettes<\/a>.<\/p>\n<ol style=\"list-style-type: decimal;\">\n<li>Usage in ggplot2. We\u2019ll use JCO and the Tron Legacy color palettes.<\/li>\n<\/ol>\n<pre class=\"r\"><code>library(\"ggsci\")\r\n# Change area fill color using jco palette\r\nbp + scale_fill_jco()\r\n\r\n\r\n# Change point color \r\nsp + scale_color_jco()<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggsci-scientific-journal-color-palettes-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggsci-scientific-journal-color-palettes-2.png\" width=\"336\" \/><\/p>\n<p>Learn more at: <a href=\"https:\/\/www.datanovia.com\/en\/blog\/top-r-color-palettes-to-know-for-great-data-visualization\/\">Top R Color Palettes to Know for Great Data Visualization<\/a><\/p>\n<\/div>\n<div id=\"wes-anderson-color-palettes\" class=\"section level3\">\n<h3>Wes Anderson color palettes<\/h3>\n<p>It contains 16 color palettes from Wes Anderson movies.<\/p>\n<pre class=\"r\"><code>library(wesanderson)\r\nnames(wes_palettes)<\/code><\/pre>\n<pre><code>##  [1] \"BottleRocket1\"  \"BottleRocket2\"  \"Rushmore1\"      \"Royal1\"        \r\n##  [5] \"Royal2\"         \"Zissou1\"        \"Darjeeling1\"    \"Darjeeling2\"   \r\n##  [9] \"Chevalier1\"     \"FantasticFox1\"  \"Moonrise1\"      \"Moonrise2\"     \r\n## [13] \"Moonrise3\"      \"Cavalcanti1\"    \"GrandBudapest1\" \"GrandBudapest2\"<\/code><\/pre>\n<p>The available color palettes are illustrated in the chart below :<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-wes-anderson-color-palettes-r-1.png\" width=\"480\" \/><\/p>\n<p>You can use the different palettes as discrete or continuous color in ggplot2, as follow:<\/p>\n<pre class=\"r\"><code>library(wesanderson)\r\n# Discrete color\r\nbp + scale_fill_manual(values = wes_palette(\"GrandBudapest1\", n = 3))\r\n\r\n# Gradient color\r\npal &lt;- wes_palette(\"Zissou1\", 100, type = \"continuous\")\r\nggplot(heatmap, aes(x = X2, y = X1, fill = value)) +\r\n  geom_tile() + \r\n  scale_fill_gradientn(colours = pal) + \r\n  scale_x_discrete(expand = c(0, 0)) +\r\n  scale_y_discrete(expand = c(0, 0)) + \r\n  coord_equal() <\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-wes-anderson-color-palettes-r-ggplot2-1.png\" width=\"336\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-wes-anderson-color-palettes-r-ggplot2-2.png\" width=\"336\" \/><\/p>\n<p>Learn more at: <a href=\"https:\/\/www.datanovia.com\/en\/blog\/top-r-color-palettes-to-know-for-great-data-visualization\/\">Top R Color Palettes to Know for Great Data Visualization<\/a><\/p>\n<\/div>\n<\/div>\n<div id=\"gradient-or-continuous-colors\" class=\"section level2\">\n<h2>Gradient or continuous colors<\/h2>\n<div id=\"default-ggplot-gradient-colors\" class=\"section level3\">\n<h3>Default ggplot gradient colors<\/h3>\n<p>For gradient colors, you should map the map the argument <code>color<\/code> and\/or <code>fill<\/code> to a continuous variable. The default ggplot2 setting for gradient colors is a continuous blue color.<\/p>\n<p>In the following example, we color points according to the variable: <code>Sepal.Length<\/code>.<\/p>\n<pre class=\"r\"><code>sp2 &lt;- ggplot(iris, aes(Sepal.Length, Sepal.Width))+\r\n  geom_point(aes(color = Sepal.Length))<\/code><\/pre>\n<\/div>\n<div id=\"key-functions-to-change-default-gradient-colors\" class=\"section level3\">\n<h3>Key functions to change default gradient colors<\/h3>\n<p>The default gradient color can be modified using the following ggplot2 functions:<\/p>\n<ul>\n<li><code>scale_color_gradient()<\/code>, <code>scale_fill_gradient()<\/code> for sequential gradients between two colors<\/li>\n<li><code>scale_color_gradient2()<\/code>, <code>scale_fill_gradient2()<\/code> for diverging gradients<\/li>\n<li><code>scale_color_gradientn()<\/code>, <code>scale_fill_gradientn()<\/code> for gradient between n colors<\/li>\n<\/ul>\n<\/div>\n<div id=\"set-gradient-between-two-colors\" class=\"section level3\">\n<h3>Set gradient between two colors<\/h3>\n<p>Change the colors for <code>low<\/code> and <code>high<\/code> ends of the gradient:<\/p>\n<pre class=\"r\"><code># Sequential color scheme. \r\n# Specify the colors for low and high ends of gradient\r\nsp2 + scale_color_gradient(low = \"blue\", high = \"red\")\r\n\r\n# Diverging color scheme\r\n# Specify also the colour for mid point\r\nmid &lt;- mean(iris$Sepal.Length)\r\nsp2 + scale_color_gradient2(midpoint = mid, low = \"blue\", mid = \"white\",\r\n                            high = \"red\", space = \"Lab\" )<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggplot-color-gradient-using-scale_color_gradient-1.png\" width=\"355.2\" \/><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-ggplot-color-gradient-using-scale_color_gradient-2.png\" width=\"355.2\" \/><\/p>\n<div class=\"success\">\n<p>Note that, the functions <code>scale_color_continuous()<\/code> and <code>scale_fill_continuous()<\/code> can be also used to set gradient colors.<\/p>\n<\/div>\n<\/div>\n<div id=\"set-gradient-between-n-colors\" class=\"section level3\">\n<h3>Set gradient between n colors<\/h3>\n<p>In the example below, we\u2019ll use the R base function <code>rainbow()<\/code> to generate a vector of 5 colors, which will be used to set the gradient colors.<\/p>\n<pre class=\"r\"><code>sp2 + scale_color_gradientn(colours = rainbow(5))<\/code><\/pre>\n<p><img decoding=\"async\" src=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/dn-tutorials\/ggplot2\/figures\/030-ggplot-colors-scale-color-gradient-between-multiple-colors-1.png\" width=\"384\" \/><\/p>\n<\/div>\n<\/div>\n<div id=\"conclusion\" class=\"section level2\">\n<h2>Conclusion<\/h2>\n<p>This article presents how to customize ggplot colors. The main points are summarized as follow.<\/p>\n<ul>\n<li>Create a basic ggplot. Map the <code>color<\/code> argument to a factor or grouping variable.<\/li>\n<\/ul>\n<pre class=\"r\"><code>p &lt;- ggplot(iris, aes(Sepal.Length, Sepal.Width))+\r\n  geom_point(aes(color = Species))\r\np<\/code><\/pre>\n<ul>\n<li>Set the color palette manually using a custom color scale:<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + scale_color_manual(values = c(\"#00AFBB\", \"#E7B800\", \"#FC4E07\"))<\/code><\/pre>\n<ul>\n<li>Use color blind-friendly palette:<\/li>\n<\/ul>\n<pre class=\"r\"><code>cbp1 &lt;- c(\"#999999\", \"#E69F00\", \"#56B4E9\", \"#009E73\",\r\n          \"#F0E442\", \"#0072B2\", \"#D55E00\", \"#CC79A7\")\r\np + scale_color_manual(values = cbp1)<\/code><\/pre>\n<ul>\n<li>Use RColorBrewer palettes:<\/li>\n<\/ul>\n<pre class=\"r\"><code>p + scale_color_brewer(palette = \"Dark2\")<\/code><\/pre>\n<ul>\n<li>Use viridis color scales:<\/li>\n<\/ul>\n<pre class=\"r\"><code>library(viridis)\r\np + scale_color_viridis(discrete = TRUE)<\/code><\/pre>\n<\/div>\n<\/div>\n<p><!--end rdoc--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article presents multiple great solutions you should know for changing ggplot colors. When creating graphs with the ggplot2 R package, colors can be specified either by name (e.g.: \u201cred\u201d) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":7712,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rating_form_position":"","rating_results_position":"","mr_structured_data_type":"","footnotes":""},"categories":[124],"tags":[315,125],"class_list":["post-8203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ggplot2","tag-ggplot2-graphical-parameters","tag-r-colors"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>GGPlot Colors Best Tricks You Will Love - Datanovia<\/title>\n<meta name=\"description\" content=\"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"GGPlot Colors Best Tricks You Will Love - Datanovia\" \/>\n<meta property=\"og:description\" content=\"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\" \/>\n<meta property=\"og:site_name\" content=\"Datanovia\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-18T13:47:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-06T05:54:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Alboukadel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Alboukadel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\"},\"author\":{\"name\":\"Alboukadel\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\"},\"headline\":\"GGPlot Colors Best Tricks You Will Love\",\"datePublished\":\"2018-11-18T13:47:49+00:00\",\"dateModified\":\"2020-05-06T05:54:32+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\"},\"wordCount\":1253,\"commentCount\":12,\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg\",\"keywords\":[\"GGPLOT2 Graphical Parameters\",\"R Colors\"],\"articleSection\":[\"ggplot2\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\",\"name\":\"GGPlot Colors Best Tricks You Will Love - Datanovia\",\"isPartOf\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg\",\"datePublished\":\"2018-11-18T13:47:49+00:00\",\"dateModified\":\"2020-05-06T05:54:32+00:00\",\"description\":\"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg\",\"width\":1024,\"height\":512},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.datanovia.com\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GGPlot Colors Best Tricks You Will Love\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#website\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"name\":\"Datanovia\",\"description\":\"Data Mining and Statistics for Decision Support\",\"publisher\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.datanovia.com\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#organization\",\"name\":\"Datanovia\",\"url\":\"https:\/\/www.datanovia.com\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"contentUrl\":\"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png\",\"width\":98,\"height\":99,\"caption\":\"Datanovia\"},\"image\":{\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e\",\"name\":\"Alboukadel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g\",\"caption\":\"Alboukadel\"},\"url\":\"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"GGPlot Colors Best Tricks You Will Love - Datanovia","description":"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/","og_locale":"en_US","og_type":"article","og_title":"GGPlot Colors Best Tricks You Will Love - Datanovia","og_description":"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.","og_url":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/","og_site_name":"Datanovia","article_published_time":"2018-11-18T13:47:49+00:00","article_modified_time":"2020-05-06T05:54:32+00:00","og_image":[{"width":1024,"height":512,"url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg","type":"image\/jpeg"}],"author":"Alboukadel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Alboukadel","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#article","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/"},"author":{"name":"Alboukadel","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e"},"headline":"GGPlot Colors Best Tricks You Will Love","datePublished":"2018-11-18T13:47:49+00:00","dateModified":"2020-05-06T05:54:32+00:00","mainEntityOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/"},"wordCount":1253,"commentCount":12,"publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg","keywords":["GGPLOT2 Graphical Parameters","R Colors"],"articleSection":["ggplot2"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/","url":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/","name":"GGPlot Colors Best Tricks You Will Love - Datanovia","isPartOf":{"@id":"https:\/\/www.datanovia.com\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage"},"thumbnailUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg","datePublished":"2018-11-18T13:47:49+00:00","dateModified":"2020-05-06T05:54:32+00:00","description":"This article presents multiple great solutions you should know for changing ggplot colors. Many predefined color palettes are also provided.","breadcrumb":{"@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#primaryimage","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/10\/IMG_4904.jpg","width":1024,"height":512},{"@type":"BreadcrumbList","@id":"https:\/\/www.datanovia.com\/en\/blog\/ggplot-colors-best-tricks-you-will-love\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.datanovia.com\/en\/"},{"@type":"ListItem","position":2,"name":"GGPlot Colors Best Tricks You Will Love"}]},{"@type":"WebSite","@id":"https:\/\/www.datanovia.com\/en\/#website","url":"https:\/\/www.datanovia.com\/en\/","name":"Datanovia","description":"Data Mining and Statistics for Decision Support","publisher":{"@id":"https:\/\/www.datanovia.com\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.datanovia.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.datanovia.com\/en\/#organization","name":"Datanovia","url":"https:\/\/www.datanovia.com\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/","url":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","contentUrl":"https:\/\/www.datanovia.com\/en\/wp-content\/uploads\/2018\/09\/datanovia-logo.png","width":98,"height":99,"caption":"Datanovia"},"image":{"@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/7767cf2bd5c91a1610c6eb53a0ff069e","name":"Alboukadel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.datanovia.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ed3108646c5c7c3d188324ab972f96ad7d9975b41b94014d7f68257791be395a?s=96&d=mm&r=g","caption":"Alboukadel"},"url":"https:\/\/www.datanovia.com\/en\/blog\/author\/kassambara\/"}]}},"multi-rating":{"mr_rating_results":[]},"_links":{"self":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/comments?post=8203"}],"version-history":[{"count":3,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8203\/revisions"}],"predecessor-version":[{"id":16079,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/posts\/8203\/revisions\/16079"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media\/7712"}],"wp:attachment":[{"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/media?parent=8203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/categories?post=8203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datanovia.com\/en\/wp-json\/wp\/v2\/tags?post=8203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}