0

I'm having an issue with Plotnine on python everything is working fine except when I attempt to specify a color in aes I get an error saying:

PlotnineError: "Could not evaluate the 'color' mapping: 'black' (original error: name 'black' is not defined)"

I have tried importing palettes but that has not worked.

from mizani.palettes import *
from palettable import *

ggplot(aes(x = 'Dest', y = 'AVG', color = 'Dest'),f) + geom_point(aes(size = 'Revenue'))+scale_size_continuous(range = (1,15))+geom_text(aes(label='Dest', color = 'black'),va='bottom')
Dom
  • 1,687
  • 6
  • 27
  • 37

1 Answers1

3
geom_text(aes(label='Dest', color = 'black'),va='bottom')

Should be

geom_text(aes(label='Dest'), color='black', va='bottom')

There is a difference between mapping values to an aesthetic and manually setting the value of an aesthetic. Everything in aes maps values to the aesthetic and those values (or expressions) should refer to columns in the dataframe. If that is not the case then you are most likely making a mistake.

has2k1
  • 2,095
  • 18
  • 16