Say I have a dateframe df, containing two continuous features X1, X2 and a boolean categorical feature, X3. How can I draw a scatterplot with X1, X2 along each axis, with the color of each datapoint determined by the value of the boolean (eg, say "red" if X3 is True, "blue" if False).
Asked
Active
Viewed 94 times
0
-
I guess as the answer does not report about the actual problem, this can indeed by savely closed as duplicate. If you have a problem implementing a solution, please share a [mcve] of the issue. – ImportanceOfBeingErnest Sep 12 '17 at 20:53
-
I had already read the topic you claim is a duplicate: however, it doesn't seem to answer the question of how I can assign a color on the basis of a categorical (rather than continuous) variable. Am I missing something? – GPB Sep 13 '17 at 14:22
-
And I'm not sure what "Importance" means: should I actually write one line of pseudo code to restate the question??? – GPB Sep 13 '17 at 14:23
-
The problem is solvable using the answer to the linked question. You should not add some pseudocode but instead a [mcve] of the code that shows the problem you are having. – ImportanceOfBeingErnest Sep 13 '17 at 14:31
-
You may also look at [this question](https://stackoverflow.com/questions/44868204/mention-label-in-matplotlib-plot-based-on-categorical-class). – ImportanceOfBeingErnest Sep 13 '17 at 14:50