Message Boards Message Boards


Color cubes with e.g. a linear function?

Posted 4 years ago
2 Replies
1 Total Likes

Dear Community,

I've constructed a few cubes with indices from 1 to 9. (see Cubes.nb) I would like to color them with e.g. a linear function. Cube 1 should be e.g. blue, cube 9 e.g. red, and the remaining cubes should change color linearly between blue and red. How could I do it? I guess it has something to do with the ColorFunction but its not clear how to use it.

Tx for the help in advance, best regards Andras

POSTED BY: Andras Gilicz
2 Replies

something like this

cubes[[ic]]     = {Hue[(3i+j)/10],Cuboid[ {i-0.5,j-0.5,1} , {i+0.5,j+0.5,2} ]} ;
POSTED BY: Frank Kampas

Dear Frank,

Perfect, thank you very much :-).


POSTED BY: Andras Gilicz
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract