Plot two conditions in one plot <p>i'm sorry to ask such a dumb question, but i can't find an answer ... </p> <p>So i have this table called : "linearsep" : </p> <pre><code> color x y 1 red 1 1 2 red 1 3 3 red 3 3 4 red 2 4 5 blue 4 1 6 blue 6 3 7 blue 2 -2 8 blue 6 -1 </code></pre> <p>each line corresponds to a points (1,1 ; 1,3 etc...) , I just want to plot the ''red'' points in red , and the "blue" points in blue.</p> <p>I know this is pretty dumb : but i just can't find a way to get a vector with the first four line. </p> <p>I thought it was something like that: </p> <blockquote> <p>plot(linearsep$color~x, linearsep$color~y)</p> </blockquote> <p>but obviously it doesn't work ... I've tested some stuff with ggplot:</p> <pre><code>ggplot(data=a, + aes(x=x, y=y, colour=color)) + geom_point() </code></pre> <p>Which works, but seems like a 'hack' , how can i just get the vector i want ? Someone could please help me ... Again sorry for such a dumb question </p>