1

I'm trying to color some lines in a ecdf here is what I've tried:

p = (
    ggplot(data, aes(color='c', x='x')) 
  + stat_ecdf()
).draw()
p = (
    ggplot(data)
  + geom_line(aes(color='c',x='x'), stat='ecdf')
).draw()

In both of these cases the result ignores the color parameter and just plots a black cdf.

If I manually split up the data by c I can plot and color the lines, however I can't work out how to get the legend working in that case.

Cjen1
  • 1,826
  • 3
  • 17
  • 47

1 Answers1

1

You need to convert your color 'c' column to object type (factors) before plotting. The same plot code should work.

data['c'] = data['c'].astype(object)
Ehsan
  • 12,072
  • 2
  • 20
  • 33