Displaying 20 results from an estimated 1000 matches similar to: "rgb and col2rgb color conversion/modification/shading"
2023 Jul 23
2
col2rgb() function
Hello I have a palette vector of colour blind colours (in hexadecimal)
which I?m using for plots, but they are not see-through, and as I wanted to
overlay some histograms I wanted to convert these colours to rgb, when you
can set the opacity.
I have found the function col2rgb(), which works in the sense that it gives
a vector of numbers but these don?t work directly in rgb because they are
too
2023 Jul 23
1
col2rgb() function
Does adjustcolor() help?
cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
"#D55E00", "#CC79A7")
plot(0,0,xlim=c(1,8),ylim=c(0,1))
points(1:8,rep(0.5,8),col=cb8,pch=19,cex=2)
points(1:8,rep(0.75,8),col=adjustcolor(cb8, alpha.f = 0.3), pch=19,cex=2)
On 2023-07-23 2:15 p.m., Nick Wray
2013 Jun 07
1
col2rgb, factors & documentation
Hello Core Folk.
Quite by accident I discovered today that col2rgb, when fed factors, acts on the integer representation of those factors:
td <- as.factor(rainbow(5)) # not how I discovered the issue!
td
res <- col2rgb(td)
res
# but
col2rgb("#FF0000FF") # this is td[1] but does not produce the same answer
res[,1]
# moreover
as.integer(td)
col2rgb(5) # the integer value of the
2023 Jul 23
2
col2rgb() function
Thanks That works nicely Nick
On Sun, 23 Jul 2023 at 19:26, Ben Bolker <bbolker at gmail.com> wrote:
> Does adjustcolor() help?
>
> cb8<- c("#000000", "#E69F00", "#56B4E9", "#009E73","#F0E442", "#0072B2",
> "#D55E00", "#CC79A7")
> plot(0,0,xlim=c(1,8),ylim=c(0,1))
>
2007 May 21
3
Selecting complementary colours
Dear r-helpers,
I wonder whether, given the "#rrggbb" representation of a colour, there is a
simple way to select the complementary colour, also expressed as a "#rrggbb"
string.
Any suggestions would be appreciated.
John
--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
2023 Jul 23
1
col2rgb() function
Just one addition which may or may not be useful: The color palette you
use is also known as "Okabe-Ito" and it is the default set of colors in
the palette.colors() function. This function also has an optional alpha
argument. So if you want to generate these colors with an alpha of 0.3 you
can also do:
palette.colors(8, alpha = 0.3)
or more explicitly
palette.colors(8, palette =
2023 Jul 23
1
col2rgb() function
Nick,
I've also made colors transparent by pasting the hex equivalent of, say,
0.3*256 = 76.9 to the hex color code. e.q. for black it might be
"#0000004d" and the 4d is 77 in hex. That way you don't need to convert
back and forth so much. If col is "#000000" the transparent version is
tcol <- paste0(col,"4d")
This would work in one step on a whole
2004 Oct 07
3
How to use alpha transparency channel for colors?
The release notes for R 2.0.0 states:
It is now possible to specify colours with a full alpha
transparency channel via the new 'alpha' argument to the
rgb() and hsv() functions, or as a string of the form "#RRGGBBAA".
NOTE: most devices draw nothing if a colour is not opaque,
but PDF and Quartz devices will render semitransparent colours.
A new argument
2004 Oct 17
1
FW: Plotcorr: colour the ellipses to emphasize the differences
-----Original Message-----
From: Duncan Murdoch [mailto:murdoch at stats.uwo.ca]
Sent: ned 2004-10-17 15:34
To: Gorjanc Gregor
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] Plotcorr: colour the ellipses to emphasize the differences
On Sun, 17 Oct 2004 02:51:58 +0200, "Gorjanc Gregor"
<Gregor.Gorjanc at bfro.uni-lj.si> wrote:
[removed old stuff]
>>I would also like to
2009 Oct 13
2
General means of matching a color specification to an official R color name
Hello List Dwellers:
I?ve looked around quite a bit, but don?t quite see an answer that I
understand.
I?m looking for a way to take any kind of color specification (rgb, hsv,
hcl, hex) and match it to the n-nearest R official color names. Clearly it
is easy to interconvert different specification schemes and color spaces,
but matching to the name seems a bit trickier. Seems like if one has a
2004 Sep 17
1
Confused about specifying plot colors as RGB values
Based on reading 'rgb' documentation, I would have thought
the following would have produced identical results. Can
someone explain how to make this happen? I need to be able
to specify an array of rgb values for the 'col' parameter.
colnames.col <- c("black", "red", "blue", "green")
colnames.rgb <- apply(as.matrix(colnames.col), 1,
2005 Dec 13
4
Ploting graphics using X tints from a color
Hi,
I'm trying to draw a 2D plot using multiple tints of red. The
(simplified) setup is the following: || year | x | y ||
My idea is that each year is plotted with a different tint of red.
Older year (lightest) -> Later year (darkest). I've managed to plot
this with different scales of grays simply by doing:
palette(gray(length(years):0/length(years)))
before the plot and for each
2009 Nov 30
4
Is there a way to convert rgb/hex value to a (nearest) color name?
Hi all, I'm trying to convert a series of rgb codes into a color name.
What is my easiest option? So far I'm stuck with just converting to
hex using rgb() and I know R knows a number of colours() but a mapping
of the two has failed me.
Any help in this regard will be highly appreciated.
Regards,
George
2008 Mar 31
2
hsv2rgb in R
I noted that there is a hsv2rgb in the C-API, but no corresponding function in
R, while rgb2hsv is available in R.
Does the functionality of hsv2rgb hide under some other name?
Dieter
2016 Apr 16
0
Mean of hexadecimal numbers
On 16/04/2016 8:47 AM, Atte Tenkanen wrote:
> Hi,
>
> How would you calculate the "mean colour" of several colours, for
> example c("#FF7C00","#00BF40","#FFFF00")?
>
Bert answered your subject line question. Your text is asking something
else: if those are colours, you don't want to treat each of them as a
single integer.
A
2000 Mar 29
1
pre summary: mapping of colornames into hsv?
Hi Martin,
Great that you follow this. My original intention was to be able to
translate colornames to hsv because this would allow using colornames to cut
out a certain part of the colorwheel for colorcoding (HSV component H, see
my code below)
I think internally we might have colors represented as
Colornames, ColorIntegers, ColorHexcodes, ColorRGBs, ColorHSVs (ColorCMYs?)
however the R-user
2010 Jul 15
2
replace negative numbers by smallest positive value in matrix
Hi Group,
I have a matrix, and I would like to replace numbers less than 0 by
the smallest minimum number. Below is an
small matrix, and the loop I used. I would like to get suggestions on
the "R way" to do this.
Thanks,
Juliet
# example data set
mymat <- structure(c(-0.503183609420937, 0.179063475173256, 0.130473004669938,
-1.80825226960127, -0.794910626384209, 1.03857280868547,
2017 Jan 21
2
problema con grafico lattice ....
Hola,
Por si lo quieres con colores rellenando cada punto:
#----------------
library(data.table)
library(lattice)
dat <- read.table("pba.csv", header=TRUE, dec=",", as.is=TRUE)
row.names(dat) <- NULL
dat <- as.data.table(dat)
dat$mycol <- ifelse(dat$sol =="ControlAE", "red", dat$sol)
dat$mycol <- ifelse(dat$mycol
2012 Jul 29
1
Zoo panel function
I would really like some help with understanding the panel function, in
zoo. Thank you.
R 15.1 and zoo 1.7-7.
library(zoo)
x = seq(0,3*pi,length.out=100)
y = sin(x)
zobj = zoo(y, x)
###########################################################
## EXAMPLE 1 - GLOBAL ARGUMENT
## This panel function works
## But, it relies on mycol, which is a global variable
2005 Jul 07
2
Brewer colours
Anyone who is interested in using optimal colour palettes should
look at the work of Cindy Brewer: www.colorbrewer.org
I have written code to use her colour schemes in R. It is
included below. Perhaps someone may find this interesting enough
to work into a package.
Included also is a function showpalette, which was posted here a
while back. I don't remember who wrote it.
I have copied all