Grasshopper

algorithmic modeling for Rhino

HOW COULD I ASSIGN DIFFERENT COLORS TO DIFFERENT VALUES?

Hi,

I have a list of numbers which correspond different lines, as attached. I want assign different colors to the lines wich correspond different values. I can't do it with gradient component, because I have very similar colors for little variation of values, so I can't distinguish lines with different values. I hope Iwas clear!

Views: 3713

Attachments:

Replies to This Discussion

You can draw individual lines using individual colours, so the problem becomes assigning different colours to all different numbers.

You could still use a gradient, but instead of mapping the actual value (which would indeed result in two very similar values being drawn using two very similar colours), you can map the indexed value. In other words, first you create a set containing all unique numbers, say {0.0, 0.037, 0.038, 0.32, 0.44, 0.71}, and then you find for each number at what index it occurs. That way 0.0 becomes 0, 0.037 becomes 1, 0.038 becomes 2, 0.32 becomes 3, 0.44 becomes 4 and 0.71 becomes 5. By evaluating a gradient based on the index you get rid of the 'very close together' problem.

However it would be easier to suggest possible solutions if you upload a gh file with the numbers and lines embedded in it.

Hi David,

I tried this solution, but I still have very similar colors. I tried to simplify my file and I uploaded it. Thank you very much!

Attachments:

I attached an implementation of my initial suggestion, except instead of using a Gradient (which necessarily consists of lots of colours that are very similar to other colours near them) I switched to a Populate 3d approach.

The Populate component fills a box shaped volume with 3d points that are all roughly equally far away from each other. By then mapping the XYZ coordinates to RGB channels I can create a palette of N colours that are all very different from each other.

Attachments:

And of course you can always manually create a palette. Upside is you can pick colours that have meaning to you, downside is that you may need to update the palette if the number of unique values changes.

Thank you very much! This is exactly what I want!

Valentina

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service