# Exercise: use the corresponding factor_cmap to color map a scatter plot of the iris data set
from bokeh.palettes import Viridis256
from bokeh.sampledata.iris import flowers
from bokeh.transform import factor_cmap
p = figure(title="Factor Color Map")
p.scatter(flowers['petal_width'], flowers['petal_length'], color=factor_cmap(flowers['species'], Viridis256. factors == flowers['species']))
AttributeError: ‘tuple’ object has no attribute ‘factors’
Given the failure of the preceding exercise with log_cmap, the failure here is not the least bit surprising to me, since this is very nearly the identical issue I came to the forum about the first time. I don’t get it. Please explain it to me like I was 5 years old.
In Python, parameters passed to functions are separated by commas. You have a period (.) after Viridis256 instead of a comma (,) Just to be clear, any time there is a SyntaxError that means you have written invalid Python code.
@malikarumi I don’t mean this disrespectfully. No one is innately endowed with Python knowledge, it’s something we all have to start from the beginning, and learn over time. I do think that your attempt to learn Bokeh is currently hampered by a lack of basic knowledge of Python in general, and I would advise that you take a step back and look into some basic Python tutorials first, before attempting to dive into a large and complicated library like Bokeh. This forum is for specialized support that benefits from deep Bokeh expertise. It not the appropriate place to seek basic Python programming help.