0

I have a df like so:

a        b    c
0.996    0    0
0.995    0    0
0.987    1    1
0.989    1    1
0.975    1    1
0.988    0    0
0.985    0    0
0.980    0    0
0.978    4    1
0.975    4    1
0.972    4    1
0.965    0    0
...          

Column a is some continuous value, column c is a binary value that tells me if column b is non-zero. I'm plotting like this:

df[['a', 'c']].plot()

This gives me a plot with two lines. I'm mainly interested in what values of a are associated with the presence of some feature (indicated in c). However, I'm wondering if there is a way to color the binary c line differently based on values of b (the actual features)? I don't particularly care about what the colors are except that they are consistent for the same value of b and different for different values. Any ideas?

Thanks so much!

Arkansin
  • 47
  • 6

1 Answers1

0

I would add another column to my dataframe with a condition - when C=1 black, or when C=0 white.

Then you can use either seaborn's facetgrid ( to specify hue as that added col) or you can also use a scatter plot and specify the color as that column)

ilearn
  • 183
  • 3
  • 16
  • you can follow this example after you added a new column : https://stackoverflow.com/questions/14885895/color-by-column-values-in-matplotlib – ilearn Aug 26 '20 at 23:27