this is related to this question , but perhaps a simpler example. I am curious if there is a reasonable way to calculate a multidimensional color gradient, given three or four arbitrary colors, as the r function does rgb()with red, green, blue? the one-dimensional gradient is simple (Fig. 1), but then it is not clear to me how to calculate the two-dimensional gradient (Fig. 2) inside the triangle . the edges are light. this is what is considered inside
one.dimensions <- colorRampPalette( c( "orange" , "blue" ) )( 100 )
plot( 1:100 , rep( 1 , 100 ) , col = one.dimensions , cex = 3 , pch = 16 , main = 'one dimensional gradient' )

dimensions13 <- colorRampPalette( c( "orange" , "blue" ) )( 100 )
dimensions12 <- colorRampPalette( c( "orange" , "red" ) )( 100 )
dimensions23 <- colorRampPalette( c( "blue" , "red" ) )( 100 )
plot( 1:100 , c( 1:50 , 50:1 ) , type = 'n' , main = 'two dimensional gradient' )
points( 1:100 , rep( 1 , 100 ) , col = dimensions12 , cex = 3 , pch = 16 )
points( seq( 1 , 50 , length = 100 ) , seq( 1 , 50 , length = 100 ) , col = dimensions13 , cex = 3 , pch = 16 )
points( seq( 50 , 100 , length = 100 ) , seq( 50 , 1 , length = 100 ) , col = dimensions23 , cex = 3 , pch = 16 )
