Map value to color scale

后端 未结 5 901
执念已碎
执念已碎 2021-01-18 11:13

I have a list of values which should be plotted to a map with a certain color. The plotting to the map is already done, but I need to figure out a way to map the value

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-18 11:37

    This is one-function-only code to convert any number from any given range (let's say [0,20]) to particular color where 0 is red, 10 is yellow, 20 is green. You can use any colors and even use combination of 4 colors, so it's red - yellow - green - blue.

    See the end of the gist file, where this function is used.

    Gist with the code: Click here

提交回复
热议问题