Altair-条形图中缺少操作按钮

时间:2020-02-19 18:00:13

标签: python altair

Altair的新手(很棒的包装!)

在2个相似的图表中,一个具有操作按钮,而另一个则没有。有什么见解吗?我想同时使用动作按钮(保存到SVG)。

以下代码:

chart = alt.Chart(df1).mark_bar(size = 25).encode(
    x = alt.X('drg3:N',sort=None, 
              axis = alt.Axis(title = "DRG")),
    y = alt.Y('discharges:Q', 
              axis = alt.Axis(title = "Discharges", format = "s"),
              scale = alt.Scale()),
).properties(
    title = "Top DRGs, based on Discharges in 2017",
)
chart

生成带有操作按钮的图表

enter image description here

但是,以下代码


chart = alt.Chart(df1).mark_bar(size = 25).encode(
    x = alt.X('drg3:N',sort=None, 
              axis = alt.Axis(title = "DRG")),
    y = alt.Y('disc_times_pay:Q', 
              axis = alt.Axis(title = "Payments (in '000,000,000s')", format = "s"),
              scale = alt.Scale()),
).properties(
    title = "Top DRGs, based on Payments in 2017",
)
chart

生成类似的图形,但是缺少操作按钮

enter image description here

0 个答案:

没有答案