Questions tagged [viridis]

An R package implementing several popular color maps, such as the 'viridis' (the default) 'magma', 'plasma', 'inferno', and 'cividis' in R. These color maps are designed to be perfectly perceptually-uniform, both in regular form and also when converted to black-and-white. They are also designed to be perceived by readers with the most common form of color blindness (all color maps in this package) and color vision deficiency ('cividis' only).

61 questions
48
votes
6 answers

What is a "good" palette for divergent colors in R? (or: can viridis and magma be combined together?)

I am interested in having a "good" divergent color pallette. One could obviously use just red, white, and blue: img <- function(obj, nam) { image(1:length(obj), 1, as.matrix(1:length(obj)), col=obj, main = nam, ylab = "", xaxt = "n", yaxt…
Tal Galili
  • 24,605
  • 44
  • 129
  • 187
21
votes
4 answers

How do I limit the range of the viridis colour scale?

I have two sets of data, which I want to present using a heat map with the viridis color scale. For the first data set, my values range from 0 to 1.2 and I can easily see the differences I want to see. However my second data set has some outliers,…
Martin B.
  • 235
  • 1
  • 2
  • 5
8
votes
1 answer

Set the max value in colormap when using scale_color_viridis

Here is the code: pic = ggplot(df_2, aes(x = df_2$X, xend = df_2$X + df_2$dx, y = df_2$Y, yend = df_2$Y + df_2$dy, color = df_2$speedkt)) + labs(title ="Surface Currents", x = "Longitude", y = "Latitude", colour="Speed (kts)") + …
Justin
  • 327
  • 3
  • 13
7
votes
1 answer

How to extract from a ggplot figure which Hex color codes were used in the viridis color palette?

After making a figure in ggplot and using a viridis palette, I would like to get a list of Hex color codes for all colors which were randomly selected for that particular plot. Is that possible? Here is the data: df = data.frame(Cell =…
user7395965
  • 397
  • 5
  • 17
7
votes
2 answers

Mapping dates to the viridis colour scale in ggplot2

I'm trying to map dates to the viridis colour scale in ggplot2. The default ggplot colour scale works fine for dates. But I'm having trouble mapping them to the viridis scale, getting an error regarding 'origin' not being supplied to…
Anna Krystalli
  • 413
  • 3
  • 13
6
votes
1 answer

Bubble map legend color in ggplot2 using viridis

Hello I would like the bubbles in the legend of this bubble map to be colored in the viridis colors used in the chart. I figured out how to customize the colors using a simple color (e.g. orange here) but I'm I'm not sure how to override aes with…
aanand
  • 63
  • 3
6
votes
1 answer

Modifying viridis colormap (replacing some colors)

I've searched around and found things that came close to working but nothing exactly suiting what I need. Basically, I really like the viridis colormap as a starting point. However, I would like to replace the purple at the lowest end of the map…
HelloKitty
  • 61
  • 1
  • 2
6
votes
2 answers

discretizing viridis ggplot color scale

I have an ordered factor variable that I would like to plot using ggplot2. Is there any way I can use scale_color_viridis(), a continuous color scale, with this ordered factor without casting the factor to numeric? The…
RoyalTS
  • 9,545
  • 12
  • 60
  • 101
4
votes
1 answer

Fill in continuous colors in geom_sf

I am running codes to create maps in R: library(tidyverse) library(ggplot2) library(eurostat) library(janitor) library(sf) eugd <- eurostat_geodata_60_2016 %>% clean_names() eugdtr <- eugd %>% st_transform(crs = 3035) gd_de <- eugdtr %>%…
sylvia
  • 197
  • 1
  • 8
4
votes
1 answer

Use viridis and Map values to colour in a histogram plot

I am trying to recreate the two plots on the left: The colour gradient is supposed to be lighter at 0, and darker at the extreme values. I want to use the viridis package to create the colour gradient. Here is my sample…
Esther
  • 441
  • 2
  • 15
4
votes
3 answers

Can't load the r package 'arulesViz' because no package called 'viridis'

I want to use 'arulesViz' to visualize association rule, but when I load the package, r give me an error: >library(arulesViz) Error: package or namespace load failed for ‘arulesViz’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),…
Bonnie Gu
  • 51
  • 1
  • 4
3
votes
1 answer

How to use a non-default colorscale in R plotly chloropleth maps?

I'm creating a chloropleth map in R using plotly, and the only trouble I'm having is setting a different colorscale. I would like to use the magma colorscale from the viridis package, but I can't seem to figure out the correct way to do it. I've…
mgriffin
  • 67
  • 5
3
votes
1 answer

Using ggplot2 and viridis, fill histogram based on other variable

I am trying to create the top left graph in this figure in ggplot, using viridis to make the colour gradient. Here is my sample data: # simulate t-values data = data.frame(sim =1:10000, t_0= rt(n = 10000,df =12, ncp=0), …
Esther
  • 441
  • 2
  • 15
3
votes
1 answer

viridis ggplot2 color package won't install , even with dependencies = TRUE

I boot up a clean instance of R Studio. I don't save my environments and I don't use an Rprofile file. I tried both commands: install.packages("viridis") install.packages("viridis", dependencies = TRUE) and I get this error: installing source…
stackinator
  • 5,429
  • 8
  • 43
  • 84
2
votes
1 answer

Identifying colour codes for Viridis Palette - mako option G

On many of my images thus far, I have been using the viridis colour palette - Option G (or Mako). I've been using functions to select from the palette, such as scale_fill_viridis_d(option = "G"). However, I'd like to sample from this palette and…
EB3112
  • 235
  • 1
  • 6
1
2 3 4 5