在以下直方图中,对于已分箱值的柱状,我遇到了着色问题。我想要将所有在 x 轴(信用)上小于 50 的柱子着色。如何在 Altair 中实现?
base = alt.Chart(X_train)
histogram = base.mark_bar().encode(
alt.X('Creditworthiness', bin=True),
y='count()',
color=alt.condition(
alt.datum.Creditworthiness < 50,
alt.value("steelblue"), # The positive color
alt.value("orange") # The negative color
)
)
threshold_line = pd.DataFrame([{"threshold": max_profit_threshold}])
mark = alt.Chart(threshold_line).mark_rule(color="#e45755").encode(
x='threshold:Q',
size=alt.value(2)
)
histogram + mark
alt.datum.*
访问它。例如,特殊字符如何处理,大小写是否敏感等等... - tkollehbin_maxbins_10_Creditworthiness_end
这个名称是从哪里来的? - PaleNeutron