Displaying 20 results from an estimated 2000 matches similar to: "Mean of hexadecimal numbers"
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
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
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
2016 Apr 16
0
Mean of hexadecimal numbers
Since these are color strings, you can use functions 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
2016 Apr 16
0
Mean of hexadecimal numbers
?strtoi
You'll have to remove the "#" first, e.g. via substring()
-- 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 5:47 AM, Atte Tenkanen <attenka at utu.fi> wrote:
> Hi,
>
> How
2016 Apr 16
0
Mean of hexadecimal numbers
On 16/04/2016 12:33 PM, Atte Tenkanen wrote:
> Hm...,
>
> 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))
>
2013 Jul 24
1
Alpha channel in colorRamp() and colorRampPalette()
Hi all,
I had the need to create a colorbar considering the alpha channel of the colors, but colorRamp() and colorRampPalette() ignored the alpha argument in rgb(). So I performed some minor modifs. in their codes, as to support the interpolation using the alpha channel.
I guess that those simple modifications might be useful for other people, so perhaps it would be worth to add them to
2010 Sep 21
1
Colorramp in Maptools, how to choose min and max values for the fg= argument
Hello,
I am using maptools for plooting geographical data.
The colour of the region indicates some region dependent value
(population for example).
I pass the colours of the regions to the plot.Map function by defining
the foreground colour:
jet.colors = colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
"#7FFF7F", "yellow",
2012 Dec 17
3
How to test whether is.element() returns only TRUE's
Hi,
How can I test, whether all the values that is.element() -function returns are TRUE's
Eg.
> (is.element(c(1,4,2),c(1,2,3)))
[1] TRUE FALSE TRUE
This doesn't work:
> (is.element(c(1,4,2),c(1,2,3)))==TRUE
[1] TRUE FALSE TRUE
Best,
Atte Tenkanen, FT, MuM
http://users.utu.fi/attenka/
2006 Oct 06
4
Row comparisons to a new matrix?
Hi,
Can somebody tell me, which is the fastest way to make comparisons between all rows in a matrix (here A) and put the results to the new symmetric matrix? I have here used cosine distance as an example, but the comparison function can be any other, euclidean dist etc.
A=rbind(c(2,3),c(4,5),c(-1,2),c(5,6))
M=matrix(nrow=length(A[,1]),ncol=length(A[,1]))
for(i in 1:length(A[,1]))
{
for(j in
2009 Apr 17
1
ColorRamp different from ColorRampPalette
I try to use ColorRamp as ColorRampPalette (i.e. with the same gradient), but
it seems there is a nuance that I've missed.
pal.crp<-colorRampPalette( c("blue", "white", "red"), space = "rgb")
plot(rep(0,40),pch=16,col=pal.crp(40))
# is great
But, using the same gradient with colorRamp is giving erratic colors.
pal.cr<-colorRamp(
2006 Jun 19
3
Border line width?
Is there some way to change the line widths of plot borders?
I couldn't find any parameters for that purpose.
Atte Tenkanen
University of Turku, Finland
2005 Oct 03
5
heatmap
Hi,
i created a graph with heatmap(sma) function:
heatmap(dataHeat(x))
and I wish to change the gradation of colors from blue to red, how could
i do?
Using "heatmap(dataHeat(x), col=c(2,4))" i will use only 2 colors
without gradation.
Ty so much
Andrea
2006 Mar 18
2
How to divide too long labels?
Is there any possibility to divide too long text in a plot to two or more
lines, when using labels-parameter in the text()-command?
Here is an example picture:
http://users.utu.fi/attenka/253.jpeg
My example script is something like this:
text(1,0.7,labels=Chordnames[fnid(pcs%%12)]) # according to Larry
Solomon's table http://solomonsmusic.net/pcsets.htm
Chordnames is a long vector with
2016 Apr 27
3
Same sum, different sets of integers
Hi,
Do you have ideas, how to find all those different combinations of
integers (>0) that produce as a sum, a certain integer.
i.e.: if that sum is
3, the possibilities are c(1,1,1), c(1,2), c(2,1)
4, the possibilities are
c(1,1,1,1),c(1,1,2),c(1,2,1),c(2,1,1),c(2,2),c(1,3),c(3,1)
etc.
Best regards,
Atte Tenkanen
2007 May 06
7
A function for raising a matrix to a power?
Hi,
Is there a function for raising a matrix to a power? For example if you like to compute A%*%A%*%A, is there an abbreviation similar to A^3?
Atte Tenkanen
> A=rbind(c(1,1),c(-1,-2))
> A
[,1] [,2]
[1,] 1 1
[2,] -1 -2
> A^3
[,1] [,2]
[1,] 1 1
[2,] -1 -8
But:
> A%*%A%*%A
[,1] [,2]
[1,] 1 2
[2,] -2 -5
2006 Aug 16
5
How to remove similar successive objects from a vector?
Is there some (much) more efficient way to do this?
VECTOR=c(3,2,4,5,5,3,3,5,1,6,6);
NEWVECTOR=VECTOR[1];
for(i in 1:(length(VECTOR)-1))
{
if((identical(VECTOR[i], VECTOR[i+1]))==FALSE){
NEWVECTOR=c(NEWVECTOR,VECTOR[i+1])}
}
> VECTOR
[1] 3 2 4 5 5 3 3 5 1 6 6
> NEWVECTOR
[1] 3 2 4 5 3 5 1 6
_______________________________
Atte Tenkanen
University of Turku, Finland
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
2010 Apr 16
3
Is it ok to apply the z.test this way?
Dear R-users,
I want to check if certain values are from random distribution, that includes values between 0-1. So, it is not really normal even though shapiro.test says it is highly normal... Can I do something like this and think that the values given are right. z.test is from package TeachingDemos.
-------------------------------------------------------------------------------
2006 Sep 08
8
Weighted association map
Could somebody program this kind of plot type to R, if none exists,
based on mds or correlation tables or some more suitable method? What
do you think about idea? Does it work? None similar or better exists?
http://weightedassociationmap.blogspot.com/
Atte Tenkanen
University of Turku, Finland