Displaying 20 results from an estimated 66 matches for "col2rgb".
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(...
2006 Aug 01
2
rgb and col2rgb color conversion/modification/shading
...I have a lot of colored objects and
want each one printed as a foreground against a slightly lighter background.
I thought I could try something like changing the alpha channel by first
converting it to rgb.
But prior to trying that, I'm stuck with how to get the color after converting
using col2rgb() to be interpreted again as a color, rather than a simple
vector?
Anyone have any help/ or alternative suggestion...
Thanks, -c
----------------------
TRYING WITH A SINGLE COLOR:
mycol<-"red"
> col2rgb(mycol)
[,1]
red 255
green 0
blue 0
> rgb(col2rgb(mycol),...
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 big. If I divide through to make them all less than 1 I don?t get the
corresponding colour-blind hue, but something somewhat off.
Here is the colour-blind palette in a plot:
*...
2023 Jul 23
1
col2rgb() function
...gt; 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 big. If I divide through to make them all less than 1 I don?t get the
> corresponding colour-blind hue, but something somewhat off.
>
> Here is the colour-bli...
2023 Jul 23
2
col2rgb() function
...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 big. If I divide through to make them all less than 1 I don?t get
> the
> > corresponding colour-blind hue, but something somewhat off.
> >...
2023 Jul 23
1
col2rgb() function
...s (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 big. If I divide through to make them all less than 1 I don?t get
>> the
>>> corresponding colour-blind hue, but something somew...
2023 Jul 23
1
col2rgb() function
...s (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 big. If I divide through to make them all less than 1 I don?t get
>> the
>>> corresponding colour-blind hue, but something somew...
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
2016 Apr 16
1
Mean of hexadecimal numbers
Hm...,
Should these two versions produce the same solution? Unfortunately and
shame to confess, I don't know much about the colors in R:
myColors <- c("#FF7C00","#00BF40","#FFFF00")
Colors=rgb2hsv(col2rgb(myColors))
apply(Colors,1,mean)
h s v
0.2122974 1.0000000 0.9163399
* * * * *
# Average the 1st two by taking the middle colour of a 3 colour palette
x <- colorRampPalette(c("#FF7C00","#00BF40"), space = "Lab")(3)[2]
# Average in the thi...
2003 Aug 29
2
Lattice plot questions
Win2k, R1.7.1:
I am currently working with some growth curve data from a
biotoxicology experiment. Each of 12 subjects had their blood
drawn at 0, 2, 4, 6, 8, and 10 weeks. For the purposes of the
project, it would be helpful if I were able to do the following:
a. Produce 12 panels, each displaying the *same* data, with
the "strip" at the top of a particular panel showing
2016 Apr 16
0
Mean of hexadecimal numbers
...in the grDevices
package (other others) to manipulate them. E.g., you can convert them
to various color spaces and perhaps use the mean in one of those
spaces as your 'average color'.
> myColors <- c(One="#FF7C00",Two="#00BF40",Three="#FFFF00")
> col2rgb(myColors)
One Two Three
red 255 0 255
green 124 191 255
blue 0 64 0
> rgb2hsv(col2rgb(myColors))
One Two Three
h 0.08104575 0.3891798 0.1666667
s 1.00000000 1.0000000 1.0000000
v 1.00000000 0.7490196 1.0000000
Bill Dunlap
TIBCO Softwa...
2016 Apr 16
2
Mean of hexadecimal numbers
... and if you need to convert back: ?as.hexmode
-- Bert
Bert Gunter
"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Sat, Apr 16, 2016 at 8:20 AM, Bert Gunter <bgunter.4567 at gmail.com> wrote:
> ?strtoi
>
> You'll have to remove
2004 Oct 07
3
How to use alpha transparency channel for colors?
...ia 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 'alpha' to the function col2rgb()
provides the ability to return the alpha component of
colours (as well as the red, green, and blue components).
I'm using R 2.0.0 on Windows 2000 and wanted to try this feature. The
following simple test works fine:
pdf("c:/alpha.pdf")
plot(rnorm(1:100),rnorm(1:100),col="...
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
2009 Oct 13
2
General means of matching a color specification to an official R color name
...ow much about
fuzzy matching.
For example, following some examples I found in the archives and the wiki, I
wrote this little function to create a table of official R colors and sort
it if desired:
colorSpecTable <- function(col = colors(), sort = NULL){
require(gplots)
rgbcodes <- t(col2rgb(col))
names <- col
hex <- col2hex(col)
df <- data.frame(name = names, hex.code = hex, rgbcodes)
# additional elements for other color spaces could be added
if (!identical(sort, NULL)) df <- sort.data.frame(df, by = sort)
}
Note that sort.data.frame is from the R-...
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
2003 Jun 27
2
Color names
How does one get a list of all the color names supported by
R and the mapping between color names and hex codes? Color
names are things like "red", "salmon", etc.
I am using Windows 2000 Professional and R 1.7.1.
2004 Sep 17
1
Confused about specifying plot colors as RGB values
...d 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, col2rgb)
dimnames(colnames.rgb)[[2]] <- colnames.col
baseline <- 1:32
offset2 <- 2*baseline
offset3 <- 3*baseline
offset4 <- 4*baseline
offsets <- cbind(offset2, offset3, offset4)
# Produces expected result
X11()
matplot(baseline, col = colnames.col[1], type = "l")
matlines(of...
2016 Apr 16
0
Mean of hexadecimal numbers
...Should these two versions produce the same solution?
I wouldn't expect them to.
Duncan Murdoch
Unfortunately and
> shame to confess, I don't know much about the colors in R:
>
> myColors <- c("#FF7C00","#00BF40","#FFFF00")
> Colors=rgb2hsv(col2rgb(myColors))
> apply(Colors,1,mean)
>
> h s v
> 0.2122974 1.0000000 0.9163399
>
> * * * * *
>
> # Average the 1st two by taking the middle colour of a 3 colour palette
> x <- colorRampPalette(c("#FF7C00","#00BF40"), space = &...