How do I make the following plot in R?
I have a file of the format:
0 2 5 911.2
0 4 10 842.59
1 6 15 813.23
1 8 20 823.23
1 2 15 813.31
0 4 5 844.59
0 6 25 854.54
The first column can be 0 or 1 only. The second column can be 2, 4, 6, 8 or 1. The third column is an integer. The fourth column is a double.
I want to create a plot such that that the X axis is the third column, the Y axis is the fourth column, the color designates the number in the second column (with maybe going from green to red in a cold-hot color scheme) and the shape (let’s say triangle versus circle) tells whether the first column is 1 or 0. I would also like a legend for all of this (the color and the shape of the points).
Any ideas?
I know how to create the matrix, so you can assume that I have a file loaded as a matrix there.
Thanks.
Give this a go.