The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

RColorConesa

Installation

You can install the released version of RColorConesa from GitHub with:

# install.packages("devtools")
devtools::install_github("ConesaLab/RColorConesa")

Information

The package RColorConesa is a color packages with different palletes inspired by the corporative image of the Conesa Lab.

Logo ConesaLab

Palettes

RColorConesa consists of seven main colours from which a number of different colour palettes have been created. Each palette have the continuous and the continuous form as you can see in next examples.

Palette - main

#> Warning: `qplot()` was deprecated in ggplot2 3.4.0.
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
#> generated.

Palette - nature

Palette - sunshine

Palette - hot

Palette - warm

Palette - cold

Palette - complete

Example - plot()

This is a basic example which shows you how to solve a common problem using the databases “iris” and the basic ploting function in R. The objetive is color by spsecie using the RcolorConesa packages.

To do this, we can use the funtion “colorConesa()” which returns a list of as many colors of you needed.

library(RColorConesa)

n_species <- length(levels(iris$Species))
colorSpecies <- colorConesa(n_species, palette = "main")

plot(x = iris$Sepal.Length, y = iris$Sepal.Width, col = colorSpecies[iris$Species], pch = 16)
legend("bottomleft", legend=c(levels(iris$Species)), col=colorSpecies, lty=1)

Example - ggplot()

In case of ggplot(), if we want to plot by color it is much more easier to do with the functions “scale_color_conesa()” and “scale_fill_conesa()”. We plot the same result we made before.

library(RColorConesa)
library(ggplot2)

ggplot(iris, aes(Sepal.Length, Sepal.Width, color = Species)) +
  geom_point(size = 4) +
  scale_color_conesa(palette = "main")

A good point for the packages is you can use more colors that it already have. For example, we are going to color each Manufacturer from the dataset “mpg” from the package “ggplot2”.

As you can see, the palette “complete” only have 7 colors, but it can interpolate as much as need it to fill all the categories.

library(RColorConesa)
library(ggplot2)

mpg <- ggplot2::mpg

ggplot(mpg, aes(manufacturer, fill = manufacturer)) +
  geom_bar() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
  scale_fill_conesa(palette = "complete")

Finally, for continuous variables, you can change the parameter continuous to True in the functions “scale_fill_conesa()” and “scale_fill_conesa()”.

library(RColorConesa)
library(ggplot2)

df.heatmap <- expand.grid(Var1 = letters[1:15], Var2 = 1:15)
df.heatmap$score <- runif(nrow(df.heatmap), min = -5, max = 5)

ggplot(df.heatmap, aes(x = Var1, y = Var2, fill = score)) + 
  geom_tile() + 
  scale_fill_conesa(palette = "sunshine", continuous = T)

Contact

Note that RColorConesa can be updated. If you encounter a problem, please open an issue via GitHub or send an email to pedsalga@upv.edu.es.

Author

Pedro Salguero García - pedsalga@upv.edu.es

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.