Color points according to a third value

OLDen shared this question 6 months ago
Answered

Hi

Is it possible to color points in a plot according to a third value?

Regards

Olav

Comments (7)

photo
1

It's not easy to answer such a general question :)

The general answer is Yes.

Use the SetColor command and an If command into it to define the conditions.

Move the slider in the attached file and have a look to the color of point A.

Check the UnUpdate script for the slider.

photo
1

option 1 is what SImona used: fixed colors between set margins of e.g. a slider or a coordinate of a point

option 2 is to use dynamic colors in which the change of colors is dynamic.

In this example it will shift from red to blue.

So the 'right' answer to you question just depends on what you want to do, which is not clear in your question

chris


777c4d5e512cbb89bd5a7cb7ebb00bcb

photo
1

Hi Simona and CCambre

Thank you very much for the ideas/show the two different possibilities.

And I apoligize that I haven't explained myself clearly.

In the attached file I have a dataset in the spreadsheet with four columns: Age, Education, Experience and Wage (per hour).

And I have created points and a plot from the Age and the Wage columns.

My question: Can I color the points according to the value in the Experience column?

Regards

Olav

photo
1

what criteria?

 Can I color the points according to the value in the Experience column? 

photo
photo
1

Create the points in the spreadsheet with relative addressing as following:

1) create in F2 the point-command: (A2,D2)

2) mark F2 and show object-properties / advanced

3) change as the following picture (for F2)

af47d38455cd924ad14380c2643ee031

.

Note: (C2 - minExp) / (maxExp - minExp) produce a value between 0 and 1 for experience-color

This is one of several possibilities (education (B2) could be used as well)

.

4) mark F2 and hold with the left mouse-key the black square-point at bottom right (on F2)

5) move the mouse down until F50 (with the holded left mouse-key)

note: in cell F3 the point is change to (A3,D3) and in the properties C2 is chang to C3 etc.

this causes so-called relative addressing

6) mark columne F change point-size and show-label off

The above result must be same as in the attachment

photo
1

improved with a color-function.

The function is calculated in column G and used in properties/advanced in column F

photo
1

Excellent :-)

The second plot is the best.


I will work on with an RGB translation of experience/education.


Regards

Olav

© 2019 International GeoGebra Institute