我正在使用altair python库创建具有vega-lite规范的html文件。我遇到一个问题,在我的绘图中没有显示颜色。这是代码:
import altair as alt
import pandas
data = 'Test.csv' #this contains three columns: Rating, Frequency, and typ, where 'typ' is either E or O.
a = alt.Chart(data).mark_bar().encode(
alt.X('Rating', type = 'ordinal'),
alt.Y('Frequency',type = 'quantitative'),
alt.Color('typ', type = 'nominal')
)
a.save('altairtest.html')
我得到一个没有颜色的图形,图例以“典型”字样出现,但只有蓝色,文字显示为“ undefined”。
我目前在SimpleHttpsServer上本地工作。这可能是原因吗?对我来说,这种方式比使用jupyter容易。谢谢