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).
Questions tagged [viridis]
61 questions
1
vote
0 answers
How to reverse the legend ramp color in ggplot2 raster graph, without changing the assigned colors to the variables with scale_fill_viridis_d?
I have tried unsuccessfully to reverse the direction of the legend color ramp in a ggplot2 raster graph. I want the temperature ranges to be ordered from highest to lowest without changing the color assignment of the variable.
The dataframe was…

Martín Francia
- 47
- 5
1
vote
1 answer
Restore full dynamic range to a subsection of a colormap
I wish to simultaneously scatterplot two distributions on the same plot, so that I can see at a glance each distribution, as well as the relationship between them.
https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html shows:
... so if I take…

P i
- 29,020
- 36
- 159
- 267
1
vote
0 answers
Generating two non-overlapping colorspaces
I wish to simultaneously scatterplot two distributions on the same plot, so that I can see at a glance each distribution, as well as the relationship between them.
https://matplotlib.org/3.1.0/tutorials/colors/colormaps.html shows:
... so if I take…

P i
- 29,020
- 36
- 159
- 267
1
vote
3 answers
Is there a way to add a solid color after a threshold with scale_color_viridis_c from ggplot? Or to layer legends/color_bars with ggnewscale?
I'm trying to create a a plot for the accuracy of a set of models that differ in their combination of two parameters.
The accuracy doesn't exceed 0.98 for any model, and most of the models have an accuracy between 0.94 and 0.98 (btw it's just…

dbrauer
- 21
- 4
1
vote
1 answer
Equally spaced legend in a raster plot
library(raster)
library(viridis)
data(volcano)
volcanoR <- raster(volcano)
breakpoints <- c(94,100,120,140,160,180,185, 189, 195)
par(mfrow = c(1, 2))
plot(volcanoR, main = "1")
plot(volcanoR, breaks = breakpoints, col =…

89_Simple
- 3,393
- 3
- 39
- 94
1
vote
0 answers
How to assign a colormap to a matplotlib graph animation?
I have animated a two-dimensional line, and I want it to display in the viridis colormap. The code is not working, because I am unsure of where in the code to assign the colormap, and how exactly to define it.
I have tried defining 'viridis' and…

eve
- 11
- 1
1
vote
1 answer
How to implement two color scales in one ggplot2 graph
I am trying to plot a ggplot2 graph but using two different colour scales, one user defined and one defined by a separate column in my data.frame.
This is easier shown in an example:
gene chr start end aceth acvitd disttss …

reubenmcg
- 371
- 4
- 18
1
vote
2 answers
Python pcolor and colorbar dont use the whole colormap
When I try to create a simple pcolor plot with values between -2 and 10 the default pcolor and colorbar use the colormap only from -2 to 2, thus showing wrong colors.
Here is a working example:
import numpy as np
from matplotlib import pyplot as…

morten
- 65
- 1
- 2
- 4
0
votes
0 answers
In R Shiny, How do I update a leaflet map colors with a reactive variable?
I am trying to build an app in R Shiny which takes inputs from several different data sets and then maps them. My main problem is trying to get the colors to change based off of what data is selected. Currently in the UI I have a…

Bobby Griffin
- 1
- 1
0
votes
0 answers
All colors greyed out when using ggplotly with geom_tile to make interactive heatmap
I am trying to make an interactive heatmap in R using a combination of geom_tile and ggplotly. However, when I run the ggplotly command, the interactive heatmap I get back only has grey values. Moreover, the interactive hover only seems to work for…

Thomas Luypaert
- 1
- 1
0
votes
0 answers
violin plots with viridis, removing NAs
Previous Post:
I am trying to remove NAs from a set of violin plots, and the error keeps changing. With the following code, I get the message that "! Aesthetics must be either length 1 or the same as the data (61)" - but I have looked into this - am…

ksh530
- 33
- 4
0
votes
1 answer
Is there a way to add the viridis color palette to a spplot having these requirements?
I need to make a spplot for a college project. The teacher has given us instructions on how to create the spplot that shows the map. However, he gives the code with default colors and I need that the colors are ones belonging to the viridis palette…

Beatriz
- 13
- 2
0
votes
2 answers
Viridis - negative values (correlations) too similar, how color incrementally (any palette R code)?
How might I use a palette in a gt table (probably in data_color() so that negative correlations are colored more incrementally using the color-blind safe palette viridis?
Negative correlations are often in too similar of a color in this table, to my…

Rick Pack
- 1,044
- 10
- 20
0
votes
1 answer
How can I use a custome colour fill (viridis) when also using the aes(colour= variable)
I am trying to implement the viridis package using viridis:: + scale_fill_viridis().
This is my code:
ggplot(combi_plot, aes(x = day_of_symptoms, y = ct_value)) + geom_smooth(aes(colour=gender)) +
xlim(-5,20) + scale_fill_viridis()
However, this…

Milan Post
- 43
- 6
0
votes
1 answer
Is it possible to usa a custom-defined palette in ggplot2?
I would like to use a custom defined palette in drawing a graph with ggplot2. I take just an example made with viridis:
library(ggplot2)
library(viridis)
ggplot(data.frame(x = rnorm(10000), y = rnorm(10000)), aes(x = x, y = y)) +
geom_hex() +…

GiacomoDB
- 369
- 1
- 10