How to colour in the particles in my own specific way (sequence)

Asked by Xifan Li

Hi, I'm a new Yader.
Since I wanted to paint the deformation of the specimen in Figure 11 of this article, the idea I came up with was to use a different colour on the diagonal than the other areas so that I could see the result I wanted after the deformation. Of course by paraview.

Here is the paper:

I want to ask your opinions about:

[1] Is the idea correct? If so, how can I use the different colours on the diagonal of my sample?
[2] If not, could you please give some suggestions?

I will be very grateful to wait for your answers and many thanks for your help!

Question information

English Edit question
Yade Edit question
No assignee Edit question
Solved by:
Bruno Chareyre
Last query:
Last reply:
Revision history for this message
Robert Caulk (rcaulk) said :


What is "the diagonal?" What is "the other areas?" What is "the result I wanted?"

Please review our forum guidelines:



Revision history for this message
Best Bruno Chareyre (bruno-chareyre) said :


That's how bodies are colored based on their subdomain in the mpi module, it should apply for anything else with appropriate tuning:

import colorsys
colorScale = [Vector3(colorsys.hsv_to_rgb(value*1.0/numThreads, 1, 1)) for value in range(0, numThreads)]
for b in O.bodies:
   b.shape.color = colorScale[b.subdomain]


Revision history for this message
Xifan Li (shelvan) said :

Thanks Bruno Chareyre, that solved my question.