Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
rothk8675309
Contributor II
Contributor II

Change scatter chart colors based on field name

Suppose I have data that includes the length/diameter of a fruit, and its weight. I have a scatter plot showing the fruits size against it's weight, and I have the dimension as the type of fruit (banana, apple, pear, mango....). How would I assign the color of each point to the fruit type (Banana as yellow, apple as red, pear as green, and mango as yellow)?

Also, I would want this to be quick when plotting because I have over 2,000 points. 

Labels (2)
3 Replies
sergio0592
Specialist III
Specialist III

You can load a table of color and use it with : Color field as background color

Color_table:
LOAD *, rgb(R,G,B) as Color Inline [
Fruit, R, G, B
Banana,255,255,128
Apple, 255,0,0
Pear, 128,255,128
Mango,255,255,128
];

Or

Color_table:
LOAD *, Evaluate(Col) as Color Inline [
Fruit, Col
Banana,yellow()
Apple, red()
Pear, green()
Mango,yellow()
];

 

rothk8675309
Contributor II
Contributor II
Author

I have a color map that I have been using with a variable assigned to each color (e.g. vblue is '=RGB(0,0,255)'), but I don't understand what you mean by using Color field as background. Do you know of any other posts that use whatever that is?

I've attached a screen shot of what I think you might mean.

sergio0592
Specialist III
Specialist III

Yes, in background color. The idea is to associate each value of fruit with a color.

P1.png

P2.png